-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Labels
Description
I'd like to use django view-based caching to set specific cache times for my .../search and .../search/facets URLs.
How would I go about that with drf-haystack?
I tried the following based on https://www.django-rest-framework.org/api-guide/caching/ but I got errors:
class ProjectSearchViewSet(FacetMixin, HaystackViewSet):
...
@method_decorator(cache_page(60 * 30)) # minutes
def get(self, *args, **kwargs):
super(ProjectSearchView, self).get(*args, **kwargs)
@method_decorator(cache_page(60 * 30)) # minutes
def list(self, *args, **kwargs):
super(ProjectSearchView, self).list(*args, **kwargs)
e.g.
app_1 | File "/usr/local/lib/python2.7/site-packages/rest_framework/viewsets.py", line 116, in view
app_1 | return self.dispatch(request, *args, **kwargs)
app_1 | File "/usr/local/lib/python2.7/site-packages/rest_framework/views.py", line 495, in dispatch
app_1 | response = self.handle_exception(exc)
app_1 | File "/usr/local/lib/python2.7/site-packages/rest_framework/views.py", line 455, in handle_exception
app_1 | self.raise_uncaught_exception(exc)
app_1 | File "/usr/local/lib/python2.7/site-packages/rest_framework/views.py", line 466, in raise_uncaught_exception
app_1 | raise exc
app_1 | AttributeError: 'NoneType' object has no attribute 'streaming'