mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 19:14:01 +03:00
Update docs imports (#7030)
This commit is contained in:
parent
ab40b80fa6
commit
5521eacb02
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user