File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,16 @@ other cache decorators such as [`cache_page`][page] and
17
17
[ ` vary_on_cookie ` ] [ cookie ] .
18
18
19
19
``` python
20
+ from django.utils.decorators import method_decorator
21
+ from django.views.decorators.cache import cache_page
22
+ from django.views.decorators.vary import vary_on_cookie
23
+
20
24
from rest_framework.response import Response
21
25
from rest_framework.views import APIView
22
26
from rest_framework import viewsets
23
27
24
- class UserViewSet (viewsets .Viewset ):
28
+
29
+ class UserViewSet (viewsets .ViewSet ):
25
30
26
31
# Cache requested url for each user for 2 hours
27
32
@method_decorator (cache_page(60 * 60 * 2 ))
@@ -32,6 +37,7 @@ class UserViewSet(viewsets.Viewset):
32
37
}
33
38
return Response(content)
34
39
40
+
35
41
class PostView (APIView ):
36
42
37
43
# Cache page for the requested url
You can’t perform that action at this time.
0 commit comments