mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-12-25 16:18:51 +01:00
Fix #739
This commit is contained in:
parent
ab5e07e295
commit
dc503b0437
@ -20,6 +20,8 @@
|
||||
<p><a href='../'><button class="btn btn-primary btn-lg">{% trans "No, Don't Delete It" %}</button></a></p>
|
||||
|
||||
<form method='post' action='./'>
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
<button class="btn btn-danger" type='submit'>{% trans "Yes I Understand - Delete It Anyway" %}</button>
|
||||
{% csrf_token %}</form>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
@ -26,7 +26,7 @@
|
||||
<td><span title='{{ ticket.created|date:"r" }}'>{{ ticket.created|naturaltime }}</span></td>
|
||||
<td class="text-center">
|
||||
<a href='{{ ticket.get_absolute_url }}?take'><button class='btn btn-primary btn-sm'><i class="fas fa-hand-paper"></i> {% trans "Take" %}</button></a>
|
||||
<a href='{% url 'helpdesk:delete' ticket.id %}'><button class='btn btn-danger btn-sm'><i class="fas fa-trash"></i> {% trans "Delete" %}</button></a>
|
||||
<a href='{% url 'helpdesk:delete' ticket.id %}?next=dashboard'><button class='btn btn-danger btn-sm'><i class="fas fa-trash"></i> {% trans "Delete" %}</button></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
@ -66,7 +66,7 @@
|
||||
<td><span title='{{ ticket.created|date:"r" }}'>{{ ticket.created|naturaltime }}</span></td>
|
||||
<td class="text-center">
|
||||
<a href='{{ ticket.get_absolute_url }}?take'><button class='btn btn-primary btn-sm'><i class="fas fa-hand-paper"></i> {% trans "Take" %}</button></a>
|
||||
<a href='{% url 'helpdesk:delete' ticket.id %}'><button class='btn btn-danger btn-sm'><i class="fas fa-trash"></i> {% trans "Delete" %}</button></a>
|
||||
<a href='{% url 'helpdesk:delete' ticket.id %}?next=dashboard'><button class='btn btn-danger btn-sm'><i class="fas fa-trash"></i> {% trans "Delete" %}</button></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user