|
1 | 1 | from django.contrib.auth import models as auth_models
|
2 | 2 | from django.utils import encoding
|
3 | 3 | from rest_framework import generics, parsers, renderers, serializers, viewsets
|
4 | | -from rest_framework.decorators import detail_route, list_route |
5 | 4 | from rest_framework.response import Response
|
6 | 5 |
|
7 | 6 | from rest_framework_json_api import mixins, utils
|
8 | 7 |
|
9 | 8 | from ..serializers.identity import IdentitySerializer
|
10 | 9 | from ..serializers.post import PostSerializer
|
11 | 10 |
|
| 11 | +try: |
| 12 | + from rest_framework.decorators import action |
| 13 | + |
| 14 | + def detail_route(**kwargs): |
| 15 | + return action(detail=True, **kwargs) |
| 16 | + |
| 17 | + def list_route(**kwargs): |
| 18 | + return action(detail=False, **kwargs) |
| 19 | + |
| 20 | +except ImportError: |
| 21 | + from rest_framework.decorators import detail_route, list_route |
| 22 | + |
12 | 23 |
|
13 | 24 | class Identity(mixins.MultipleIDMixin, viewsets.ModelViewSet):
|
14 | 25 | queryset = auth_models.User.objects.all().order_by('pk')
|
|
0 commit comments