mirror of
https://github.com/wger-project/wger.git
synced 2026-12-05 23:44:05 +01:00
Fix RemovedInDRF310Warnings
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
# Third Party
|
||||
from django.contrib.auth.models import User
|
||||
from rest_framework import viewsets
|
||||
from rest_framework.decorators import detail_route
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.response import Response
|
||||
|
||||
# wger
|
||||
@@ -66,7 +66,7 @@ class UserProfileViewSet(viewsets.ModelViewSet):
|
||||
'''
|
||||
return [(User, 'user')]
|
||||
|
||||
@detail_route()
|
||||
@action(detail=True)
|
||||
def username(self, request, pk):
|
||||
'''
|
||||
Return the username
|
||||
|
||||
@@ -21,8 +21,8 @@ from easy_thumbnails.alias import aliases
|
||||
from easy_thumbnails.files import get_thumbnailer
|
||||
from rest_framework import viewsets
|
||||
from rest_framework.decorators import (
|
||||
api_view,
|
||||
detail_route
|
||||
action,
|
||||
api_view
|
||||
)
|
||||
from rest_framework.permissions import IsAuthenticatedOrReadOnly
|
||||
from rest_framework.response import Response
|
||||
@@ -185,7 +185,7 @@ class ExerciseImageViewSet(viewsets.ModelViewSet):
|
||||
'license',
|
||||
'license_author')
|
||||
|
||||
@detail_route()
|
||||
@action(detail=True)
|
||||
def thumbnails(self, request, pk):
|
||||
'''
|
||||
Return a list of the image's thumbnails
|
||||
|
||||
@@ -20,7 +20,7 @@ import datetime
|
||||
|
||||
# Third Party
|
||||
from rest_framework import viewsets
|
||||
from rest_framework.decorators import detail_route
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.response import Response
|
||||
|
||||
# wger
|
||||
@@ -70,7 +70,7 @@ class WorkoutViewSet(viewsets.ModelViewSet):
|
||||
'''
|
||||
serializer.save(user=self.request.user)
|
||||
|
||||
@detail_route()
|
||||
@action(detail=True)
|
||||
def canonical_representation(self, request, pk):
|
||||
'''
|
||||
Output the canonical representation of a workout
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
# Third Party
|
||||
from rest_framework import viewsets
|
||||
from rest_framework.decorators import (
|
||||
api_view,
|
||||
detail_route
|
||||
action,
|
||||
api_view
|
||||
)
|
||||
from rest_framework.response import Response
|
||||
|
||||
@@ -71,7 +71,7 @@ class IngredientViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
'license',
|
||||
'license_author')
|
||||
|
||||
@detail_route()
|
||||
@action(detail=True)
|
||||
def get_values(self, request, pk):
|
||||
'''
|
||||
Calculates the nutritional values for current ingredient and
|
||||
@@ -198,7 +198,7 @@ class NutritionPlanViewSet(viewsets.ModelViewSet):
|
||||
'''
|
||||
serializer.save(user=self.request.user, language=load_language())
|
||||
|
||||
@detail_route()
|
||||
@action(detail=True)
|
||||
def nutritional_values(self, request, pk):
|
||||
'''
|
||||
Return an overview of the nutritional plan's values
|
||||
@@ -235,7 +235,7 @@ class MealViewSet(WgerOwnerObjectModelViewSet):
|
||||
'''
|
||||
return [(NutritionPlan, 'plan')]
|
||||
|
||||
@detail_route()
|
||||
@action(detail=True)
|
||||
def nutritional_values(self, request, pk):
|
||||
'''
|
||||
Return an overview of the nutritional plan's values
|
||||
@@ -274,7 +274,7 @@ class MealItemViewSet(WgerOwnerObjectModelViewSet):
|
||||
'''
|
||||
return [(Meal, 'meal')]
|
||||
|
||||
@detail_route()
|
||||
@action(detail=True)
|
||||
def nutritional_values(self, request, pk):
|
||||
'''
|
||||
Return an overview of the nutritional plan's values
|
||||
|
||||
Reference in New Issue
Block a user