mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
django2.2: unlock djangorestframework version limit
This commit is contained in:
parent
cd2d3ee6b4
commit
c3f2d0a134
@ -25,7 +25,7 @@
|
|||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework import viewsets
|
from rest_framework import viewsets
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from rest_framework.decorators import detail_route
|
from rest_framework.decorators import action
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
|
||||||
from core.views import can_view, can_edit
|
from core.views import can_view, can_edit
|
||||||
@ -46,7 +46,7 @@ def check_if(obj, user, test):
|
|||||||
|
|
||||||
|
|
||||||
class ManageModelMixin:
|
class ManageModelMixin:
|
||||||
@detail_route()
|
@action(detail=True)
|
||||||
def id(self, request, pk=None):
|
def id(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
Get by id (api/v1/router/{pk}/id/)
|
Get by id (api/v1/router/{pk}/id/)
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.decorators import list_route
|
from rest_framework.decorators import action
|
||||||
|
|
||||||
from counter.models import Counter
|
from counter.models import Counter
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class CounterViewSet(RightModelViewSet):
|
|||||||
serializer_class = CounterSerializer
|
serializer_class = CounterSerializer
|
||||||
queryset = Counter.objects.all()
|
queryset = Counter.objects.all()
|
||||||
|
|
||||||
@list_route()
|
@action(detail=False)
|
||||||
def bar(self, request):
|
def bar(self, request):
|
||||||
"""
|
"""
|
||||||
Return all bars (api/v1/counter/bar/)
|
Return all bars (api/v1/counter/bar/)
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.decorators import list_route
|
from rest_framework.decorators import action
|
||||||
|
|
||||||
from launderette.models import Launderette, Machine, Token
|
from launderette.models import Launderette, Machine, Token
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ class LaunderetteTokenViewSet(RightModelViewSet):
|
|||||||
serializer_class = LaunderetteTokenSerializer
|
serializer_class = LaunderetteTokenSerializer
|
||||||
queryset = Token.objects.all()
|
queryset = Token.objects.all()
|
||||||
|
|
||||||
@list_route()
|
@action(detail=False)
|
||||||
def washing(self, request):
|
def washing(self, request):
|
||||||
"""
|
"""
|
||||||
Return all washing tokens (api/v1/launderette/token/washing)
|
Return all washing tokens (api/v1/launderette/token/washing)
|
||||||
@ -105,7 +105,7 @@ class LaunderetteTokenViewSet(RightModelViewSet):
|
|||||||
serializer = self.get_serializer(self.queryset, many=True)
|
serializer = self.get_serializer(self.queryset, many=True)
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|
||||||
@list_route()
|
@action(detail=False)
|
||||||
def drying(self, request):
|
def drying(self, request):
|
||||||
"""
|
"""
|
||||||
Return all drying tokens (api/v1/launderette/token/drying)
|
Return all drying tokens (api/v1/launderette/token/drying)
|
||||||
@ -114,7 +114,7 @@ class LaunderetteTokenViewSet(RightModelViewSet):
|
|||||||
serializer = self.get_serializer(self.queryset, many=True)
|
serializer = self.get_serializer(self.queryset, many=True)
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|
||||||
@list_route()
|
@action(detail=False)
|
||||||
def avaliable(self, request):
|
def avaliable(self, request):
|
||||||
"""
|
"""
|
||||||
Return all avaliable tokens (api/v1/launderette/token/avaliable)
|
Return all avaliable tokens (api/v1/launderette/token/avaliable)
|
||||||
@ -125,7 +125,7 @@ class LaunderetteTokenViewSet(RightModelViewSet):
|
|||||||
serializer = self.get_serializer(self.queryset, many=True)
|
serializer = self.get_serializer(self.queryset, many=True)
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|
||||||
@list_route()
|
@action(detail=False)
|
||||||
def unavaliable(self, request):
|
def unavaliable(self, request):
|
||||||
"""
|
"""
|
||||||
Return all unavaliable tokens (api/v1/launderette/token/unavaliable)
|
Return all unavaliable tokens (api/v1/launderette/token/unavaliable)
|
||||||
|
@ -26,7 +26,7 @@ import datetime
|
|||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.decorators import list_route
|
from rest_framework.decorators import action
|
||||||
|
|
||||||
from core.models import User
|
from core.models import User
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class UserViewSet(RightModelViewSet):
|
|||||||
serializer_class = UserSerializer
|
serializer_class = UserSerializer
|
||||||
queryset = User.objects.filter(is_active=True)
|
queryset = User.objects.filter(is_active=True)
|
||||||
|
|
||||||
@list_route()
|
@action(detail=False)
|
||||||
def birthday(self, request):
|
def birthday(self, request):
|
||||||
"""
|
"""
|
||||||
Return all users born today (api/v1/user/birstdays)
|
Return all users born today (api/v1/user/birstdays)
|
||||||
|
@ -5,7 +5,7 @@ mistune
|
|||||||
django-jinja
|
django-jinja
|
||||||
pyopenssl
|
pyopenssl
|
||||||
pytz
|
pytz
|
||||||
djangorestframework <3.10
|
djangorestframework
|
||||||
django-phonenumber-field
|
django-phonenumber-field
|
||||||
phonenumbers
|
phonenumbers
|
||||||
django-ajax-selects
|
django-ajax-selects
|
||||||
|
Loading…
Reference in New Issue
Block a user