Skip to content

Commit

Permalink
drf 3.10 drops python2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
buko106 committed Sep 11, 2019
1 parent d544e08 commit 9a70792
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
20 changes: 15 additions & 5 deletions tests/test_dynamic_routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,20 @@ class Meta:


try:
from rest_framework.decorators import detail_route, list_route
from rest_framework.decorators import action

def detail_route_decorator(**kwargs):
return action(detail=True, **kwargs)

def list_route_decorator(**kwargs):
return action(detail=False, **kwargs)
except ImportError:
pass
else:
try:
from rest_framework.decorators import detail_route as detail_route_decorator, list_route as list_route_decorator
except ImportError:
pass

if {'detail_route_decorator', 'list_route_decorator'} <= globals().keys():
def map_by_name(iterable):
ret = {}
for item in iterable:
Expand All @@ -37,15 +47,15 @@ class DetailRouteViewSet(ModelViewSet):
model = BasicModel
queryset = QS(BasicModel)

@detail_route(methods=["post"])
@detail_route_decorator(methods=["post"])
def set_password(self, request, pk=None):
return Response({'hello': 'ok'})

class ListRouteViewSet(ModelViewSet):
model = BasicModel
queryset = QS(BasicModel)

@list_route()
@list_route_decorator()
def recent_users(self, request, pk=None):
return Response([{'hello': 'ok'}])

Expand Down
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[tox]
envlist =
py27-{flake8,docs},
{py27,py34,py35,py36}-django{1.11}-drf{3.6,3.7,3.8}
py27-django1.11-drf{3.6,3.7,3.8,3.9}
{py34,py35,py36,py37}-django1.11-drf{3.6,3.7,3.8,3.9,3.10}
{py34}-django{2.0}-drf{3.7,3.8}
{py35,py36,py37}-django{2.0,2.1,2.2}-drf{3.7,3.8,3.9}
{py35,py36,py37}-django{2.0,2.1,2.2}-drf{3.7,3.8,3.9,3.10}


[testenv]
Expand All @@ -19,6 +20,7 @@ deps =
drf3.7: djangorestframework>=3.7,<3.8
drf3.8: djangorestframework>=3.8,<3.9
drf3.9: djangorestframework>=3.9,<3.10
drf3.10: djangorestframework>=3.10,<3.11
pytest-django==3.4.2
-rrequirements-tox.txt

Expand Down

0 comments on commit 9a70792

Please sign in to comment.