mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-01-08 06:59:39 +01:00
Don't use redis cache at all for ticket querysets as this breaks pagination
This commit is contained in:
parent
f840136e1e
commit
63bb949d63
@ -1,5 +1,4 @@
|
|||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.core.cache import cache
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
@ -139,21 +138,10 @@ class __Query__:
|
|||||||
# https://stackoverflow.com/questions/30487056/django-queryset-contains-duplicate-entries
|
# https://stackoverflow.com/questions/30487056/django-queryset-contains-duplicate-entries
|
||||||
return queryset.distinct()
|
return queryset.distinct()
|
||||||
|
|
||||||
def get_cache_key(self):
|
|
||||||
return str(self.huser.user.pk) + ":" + self.base64
|
|
||||||
|
|
||||||
def refresh_query(self):
|
|
||||||
tickets = self.huser.get_tickets_in_queues().select_related()
|
|
||||||
ticket_qs = self.__run__(tickets)
|
|
||||||
cache.set(self.get_cache_key(), ticket_qs, timeout=3600)
|
|
||||||
return ticket_qs
|
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
# Prefilter the allowed tickets
|
# Prefilter the allowed tickets
|
||||||
objects = cache.get(self.get_cache_key())
|
tickets = self.huser.get_tickets_in_queues().select_related()
|
||||||
if objects is not None:
|
return self.__run__(tickets)
|
||||||
return objects
|
|
||||||
return self.refresh_query()
|
|
||||||
|
|
||||||
def get_datatables_context(self, **kwargs):
|
def get_datatables_context(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -1130,8 +1130,6 @@ def ticket_list(request):
|
|||||||
|
|
||||||
urlsafe_query = query_to_base64(query_params)
|
urlsafe_query = query_to_base64(query_params)
|
||||||
|
|
||||||
Query(huser, base64query=urlsafe_query).refresh_query()
|
|
||||||
|
|
||||||
user_saved_queries = SavedSearch.objects.filter(Q(user=request.user) | Q(shared__exact=True))
|
user_saved_queries = SavedSearch.objects.filter(Q(user=request.user) | Q(shared__exact=True))
|
||||||
|
|
||||||
search_message = ''
|
search_message = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user