From dc503b0437ccc04e1a26a3d55bb378417e0661a6 Mon Sep 17 00:00:00 2001 From: bbe Date: Fri, 23 Oct 2020 14:51:53 +0200 Subject: [PATCH] Fix #739 --- helpdesk/templates/helpdesk/delete_ticket.html | 4 +++- helpdesk/templates/helpdesk/include/unassigned.html | 4 ++-- helpdesk/views/staff.py | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/helpdesk/templates/helpdesk/delete_ticket.html b/helpdesk/templates/helpdesk/delete_ticket.html index 3b84d198..4cbdfd1d 100644 --- a/helpdesk/templates/helpdesk/delete_ticket.html +++ b/helpdesk/templates/helpdesk/delete_ticket.html @@ -20,6 +20,8 @@

+ {% csrf_token %} + -{% csrf_token %}
+ {% endblock %} diff --git a/helpdesk/templates/helpdesk/include/unassigned.html b/helpdesk/templates/helpdesk/include/unassigned.html index 743d0eb9..2864e183 100644 --- a/helpdesk/templates/helpdesk/include/unassigned.html +++ b/helpdesk/templates/helpdesk/include/unassigned.html @@ -26,7 +26,7 @@ {{ ticket.created|naturaltime }} - + {% empty %} @@ -66,7 +66,7 @@ {{ ticket.created|naturaltime }} - + {% empty %} diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 6a028ec9..9fa1b869 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -227,10 +227,14 @@ def delete_ticket(request, ticket_id): if request.method == 'GET': return render(request, 'helpdesk/delete_ticket.html', { 'ticket': ticket, + 'next': request.GET.get('next', 'home') }) else: ticket.delete() - return HttpResponseRedirect(reverse('helpdesk:home')) + redirect_to = 'helpdesk:home' + if request.POST.get('next') == 'dashboard': + redirect_to = 'helpdesk:dashboard' + return HttpResponseRedirect(reverse(redirect_to)) delete_ticket = staff_member_required(delete_ticket)