|
|
@@ -6,8 +6,6 @@ from django.contrib.contenttypes.models import ContentType
|
|
|
from django.core.exceptions import FieldError, MultipleObjectsReturned, ObjectDoesNotExist
|
|
|
from django.db.models import ManyToManyField
|
|
|
from django.http import Http404
|
|
|
-from django.utils.decorators import method_decorator
|
|
|
-from django.views.decorators.cache import cache_page
|
|
|
from rest_framework.exceptions import APIException
|
|
|
from rest_framework.permissions import BasePermission
|
|
|
from rest_framework.relations import PrimaryKeyRelatedField, RelatedField
|
|
|
@@ -276,14 +274,12 @@ class ModelViewSet(_ModelViewSet):
|
|
|
# Fall back to the hard-coded serializer class
|
|
|
return self.serializer_class
|
|
|
|
|
|
- @method_decorator(cache_page(settings.CACHE_TIMEOUT))
|
|
|
def list(self, *args, **kwargs):
|
|
|
"""
|
|
|
Call to super to allow for caching
|
|
|
"""
|
|
|
return super().list(*args, **kwargs)
|
|
|
|
|
|
- @method_decorator(cache_page(settings.CACHE_TIMEOUT))
|
|
|
def retrieve(self, *args, **kwargs):
|
|
|
"""
|
|
|
Call to super to allow for caching
|
|
|
@@ -326,11 +322,9 @@ class FieldChoicesViewSet(ViewSet):
|
|
|
})
|
|
|
self._fields[key] = choices
|
|
|
|
|
|
- @method_decorator(cache_page(settings.CACHE_TIMEOUT))
|
|
|
def list(self, request):
|
|
|
return Response(self._fields)
|
|
|
|
|
|
- @method_decorator(cache_page(settings.CACHE_TIMEOUT))
|
|
|
def retrieve(self, request, pk):
|
|
|
if pk not in self._fields:
|
|
|
raise Http404
|