mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-22 07:53:19 +01:00
filtering should not be mandatory
This commit is contained in:
parent
ef9c4c589a
commit
2fbd4818c1
@ -118,7 +118,7 @@ class __Query__:
|
|||||||
|
|
||||||
sorting: The name of the column to sort by
|
sorting: The name of the column to sort by
|
||||||
"""
|
"""
|
||||||
for key in self.params['filtering'].keys():
|
for key in self.params.get('filtering', {}).keys():
|
||||||
filter = {key: self.params['filtering'][key]}
|
filter = {key: self.params['filtering'][key]}
|
||||||
queryset = queryset.filter(**filter)
|
queryset = queryset.filter(**filter)
|
||||||
queryset = queryset.filter(self.get_search_filter_args())
|
queryset = queryset.filter(self.get_search_filter_args())
|
||||||
@ -130,15 +130,18 @@ class __Query__:
|
|||||||
queryset = queryset.order_by(sorting)
|
queryset = queryset.order_by(sorting)
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
def get_cache_key(self):
|
||||||
|
return str(self.huser.user.pk) + ":" + self.base64
|
||||||
|
|
||||||
def refresh_query(self):
|
def refresh_query(self):
|
||||||
tickets = self.huser.get_tickets_in_queues().select_related()
|
tickets = self.huser.get_tickets_in_queues().select_related()
|
||||||
ticket_qs = self.__run__(tickets)
|
ticket_qs = self.__run__(tickets)
|
||||||
cache.set(self.huser.user.email + self.base64, ticket_qs, timeout=3600)
|
cache.set(self.get_cache_key(), ticket_qs, timeout=3600)
|
||||||
return ticket_qs
|
return ticket_qs
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
# Prefilter the allowed tickets
|
# Prefilter the allowed tickets
|
||||||
objects = cache.get(self.huser.user.email + self.base64)
|
objects = cache.get(self.get_cache_key())
|
||||||
if objects is not None:
|
if objects is not None:
|
||||||
return objects
|
return objects
|
||||||
return self.refresh_query()
|
return self.refresh_query()
|
||||||
@ -189,7 +192,7 @@ class __Query__:
|
|||||||
event = {
|
event = {
|
||||||
'start_date': self.mk_timeline_date(followup.date),
|
'start_date': self.mk_timeline_date(followup.date),
|
||||||
'text': {
|
'text': {
|
||||||
'headline': ticket.title + '<br/>' + followup.title,
|
'headline': ticket.title + ' - ' + followup.title,
|
||||||
'text': (followup.comment if followup.comment else _('No text')) + '<br/> <a href="%s" class="btn" role="button">%s</a>' %
|
'text': (followup.comment if followup.comment else _('No text')) + '<br/> <a href="%s" class="btn" role="button">%s</a>' %
|
||||||
(reverse('helpdesk:view', kwargs={'ticket_id': ticket.pk}), _("View ticket")),
|
(reverse('helpdesk:view', kwargs={'ticket_id': ticket.pk}), _("View ticket")),
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user