@@ -46,6 +46,7 @@ def get_rql_filter_class(self):
46
46
return ModelFilterClass
47
47
```
48
48
"""
49
+
49
50
OPENAPI_RETRIEVE_SPECIFICATION = False
50
51
51
52
_CACHES = {}
@@ -59,11 +60,13 @@ def filter_queryset(self, request, queryset, view):
59
60
filter_instance = self ._get_filter_instance (filter_class , queryset , view )
60
61
query = self .get_query (filter_instance , request , view )
61
62
62
- can_query_be_cached = all ((
63
- filter_class .QUERIES_CACHE_BACKEND ,
64
- filter_class .QUERIES_CACHE_SIZE ,
65
- request .method in ('GET' , 'HEAD' , 'OPTIONS' ),
66
- ))
63
+ can_query_be_cached = all (
64
+ (
65
+ filter_class .QUERIES_CACHE_BACKEND ,
66
+ filter_class .QUERIES_CACHE_SIZE ,
67
+ request .method in ('GET' , 'HEAD' , 'OPTIONS' ),
68
+ ),
69
+ )
67
70
if can_query_be_cached :
68
71
# We must use the combination of queryset and query to make a cache key as
69
72
# queryset can already contain some filters (e.x. based on authentication)
@@ -117,7 +120,8 @@ def get_query(cls, filter_instance, request, view):
117
120
def _get_or_init_cache (cls , filter_class , view ):
118
121
qual_name = cls ._get_filter_cls_qual_name (view , filter_class )
119
122
return cls ._CACHES .setdefault (
120
- qual_name , filter_class .QUERIES_CACHE_BACKEND (int (filter_class .QUERIES_CACHE_SIZE )),
123
+ qual_name ,
124
+ filter_class .QUERIES_CACHE_BACKEND (int (filter_class .QUERIES_CACHE_SIZE )),
121
125
)
122
126
123
127
@classmethod
@@ -135,6 +139,8 @@ def _get_filter_instance(cls, filter_class, queryset, view):
135
139
@staticmethod
136
140
def _get_filter_cls_qual_name (view , filter_class ):
137
141
return '{0}.{1}+{2}.{3}' .format (
138
- view .__class__ .__module__ , view .__class__ .__name__ ,
139
- filter_class .__module__ , filter_class .__name__ ,
142
+ view .__class__ .__module__ ,
143
+ view .__class__ .__name__ ,
144
+ filter_class .__module__ ,
145
+ filter_class .__name__ ,
140
146
)
0 commit comments