Update docs imports (#7030)

This commit is contained in:
Chris Guo 2019-11-02 01:56:59 +08:00 committed by Ryan P Kilby
parent ab40b80fa6
commit 5521eacb02

View File

@ -17,11 +17,16 @@ other cache decorators such as [`cache_page`][page] and
[`vary_on_cookie`][cookie]. [`vary_on_cookie`][cookie].
```python ```python
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django.views.decorators.vary import vary_on_cookie
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.views import APIView from rest_framework.views import APIView
from rest_framework import viewsets from rest_framework import viewsets
class UserViewSet(viewsets.Viewset):
class UserViewSet(viewsets.ViewSet):
# Cache requested url for each user for 2 hours # Cache requested url for each user for 2 hours
@method_decorator(cache_page(60*60*2)) @method_decorator(cache_page(60*60*2))
@ -32,6 +37,7 @@ class UserViewSet(viewsets.Viewset):
} }
return Response(content) return Response(content)
class PostView(APIView): class PostView(APIView):
# Cache page for the requested url # Cache page for the requested url