Add submitter email to ticket list

This commit is contained in:
Timothy Hobbs 2020-01-13 15:43:47 +01:00
parent ebd876d0e2
commit 5da7069dbd
2 changed files with 7 additions and 1 deletions

View File

@ -15,6 +15,7 @@ datatables for ticket_list.html. Called from staff.datatables_ticket_list.
class DatatablesTicketSerializer(serializers.ModelSerializer): class DatatablesTicketSerializer(serializers.ModelSerializer):
ticket = serializers.SerializerMethodField() ticket = serializers.SerializerMethodField()
assigned_to = serializers.SerializerMethodField() assigned_to = serializers.SerializerMethodField()
submitter = serializers.SerializerMethodField()
created = serializers.SerializerMethodField() created = serializers.SerializerMethodField()
due_date = serializers.SerializerMethodField() due_date = serializers.SerializerMethodField()
status = serializers.SerializerMethodField() status = serializers.SerializerMethodField()
@ -26,7 +27,7 @@ class DatatablesTicketSerializer(serializers.ModelSerializer):
model = Ticket model = Ticket
# fields = '__all__' # fields = '__all__'
fields = ('ticket', 'id', 'priority', 'title', 'queue', 'status', fields = ('ticket', 'id', 'priority', 'title', 'queue', 'status',
'created', 'due_date', 'assigned_to', 'row_class', 'created', 'due_date', 'assigned_to', 'submitter', 'row_class',
'time_spent') 'time_spent')
def get_queue(self, obj): def get_queue(self, obj):
@ -53,6 +54,9 @@ class DatatablesTicketSerializer(serializers.ModelSerializer):
else: else:
return ("None") return ("None")
def get_submitter(self, obj):
return obj.submitter_email
def get_time_spent(self, obj): def get_time_spent(self, obj):
return format_time_spent(obj.time_spent) return format_time_spent(obj.time_spent)

View File

@ -66,6 +66,7 @@
<th>{% trans "Created" %}</th> <th>{% trans "Created" %}</th>
<th>{% trans "Due Date" %}</th> <th>{% trans "Due Date" %}</th>
<th>{% trans "Owner" %}</th> <th>{% trans "Owner" %}</th>
<th>{% trans "Submitter" %}</th>
<th>{% trans "Time Spent" %}</th> <th>{% trans "Time Spent" %}</th>
</tr> </tr>
</thead> </thead>
@ -358,6 +359,7 @@
} }
} }
}, },
{"data": "submitter"},
{"data": "time_spent"}, {"data": "time_spent"},
] ]
}); });