mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-18 15:46:40 +02:00
for last_followup remove filter stub, fix localization, improve serializer
This commit is contained in:
parent
27a94dde34
commit
1e580aa59d
@ -75,15 +75,7 @@ class DatatablesTicketSerializer(serializers.ModelSerializer):
|
||||
return obj.kbitem.title if obj.kbitem else ""
|
||||
|
||||
def get_last_followup(self, obj):
|
||||
followup = obj.followup_set.order_by().annotate(
|
||||
last_followup=Window(
|
||||
expression=Max("date"),
|
||||
partition_by=[F("ticket_id"),],
|
||||
order_by="-date"
|
||||
)
|
||||
).values("last_followup").distinct().values_list("last_followup", flat=True)
|
||||
# If there are no followups for the ticket then the result will be empty
|
||||
return localtime(followup[0]).strftime('%Y-%m-%d %H:%M:%S') if followup else ""
|
||||
return obj.last_followup
|
||||
|
||||
|
||||
class FollowUpAttachmentSerializer(serializers.ModelSerializer):
|
||||
|
@ -335,7 +335,7 @@
|
||||
<script>
|
||||
window.helpdesk_settings = {
|
||||
LANGUAGE_CODE: "{{ helpdesk_settings.LANGUAGE_CODE|default:'en-US' }}",
|
||||
NO_FOLLOWUP_TEXT: "{{ helpdesk_settings.TRANSLATIONS.No_followup_found|default:'No followup found' }}"
|
||||
NO_FOLLOWUP_TEXT: "{% trans helpdesk_settings.TRANSLATIONS.No_followup_found|default:'No followup found' %}"
|
||||
};
|
||||
|
||||
function get_url(row) {
|
||||
@ -425,7 +425,7 @@
|
||||
{
|
||||
data: "last_followup",
|
||||
render: function (data, type, row) {
|
||||
let locale = window.helpdesk_settings.LANGUAGE_CODE;
|
||||
let locale = navigator.language || navigator.userLanguage || window.helpdesk_settings.LANGUAGE_CODE;
|
||||
|
||||
if (isNaN(Date.parse(data))) {
|
||||
return window.helpdesk_settings.NO_FOLLOWUP_TEXT;
|
||||
|
@ -1061,14 +1061,6 @@ def ticket_list(request):
|
||||
if date_to:
|
||||
query_params['filtering']['created__lte'] = date_to
|
||||
|
||||
followup_from = request.GET.get('followup_from')
|
||||
if followup_from:
|
||||
query_params['filtering']['followup__gte'] = followup_from
|
||||
|
||||
followup_to = request.GET.get('followup_to')
|
||||
if followup_to:
|
||||
query_params['filtering']['followup__lte'] = followup_to
|
||||
|
||||
# KEYWORD SEARCHING
|
||||
q = request.GET.get('q', '')
|
||||
context['query'] = q
|
||||
|
Loading…
x
Reference in New Issue
Block a user