diff --git a/helpdesk/settings.py b/helpdesk/settings.py
index 58f3d405..ccc7b033 100644
--- a/helpdesk/settings.py
+++ b/helpdesk/settings.py
@@ -85,6 +85,9 @@ HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE = getattr(settings, 'HELPDESK_ALLOW_NON_S
# show edit buttons in ticket follow ups.
HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP = getattr(settings, 'HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP', True)
+# show delete buttons in ticket follow ups if user is 'superuser'
+HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP = getattr(settings, 'HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP', False)
+
# show ticket edit button on top of ticket description.
HELPDESK_SHOW_EDIT_BUTTON_TICKET_TOP = getattr(settings, 'HELPDESK_SHOW_EDIT_BUTTON_TICKET_TOP', True)
diff --git a/helpdesk/templates/helpdesk/ticket.html b/helpdesk/templates/helpdesk/ticket.html
index a61fa1bc..ceff81a8 100644
--- a/helpdesk/templates/helpdesk/ticket.html
+++ b/helpdesk/templates/helpdesk/ticket.html
@@ -74,6 +74,9 @@ function googleTranslateElementInit() {
{% endif %}
{% endif %}
+ {% if user.is_superuser and helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP %}
+
+ {% endif %}
{% else %}
@@ -84,6 +87,9 @@ function googleTranslateElementInit() {
{% endif %}
{% endif %}
+ {% if user.is_superuser and helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP %}
+
+ {% endif %}
{% endif %}
{% if followup.comment %}{{ followup.comment|force_escape|urlizetrunc:50|num_to_link|linebreaksbr }}{% endif %}
diff --git a/helpdesk/urls.py b/helpdesk/urls.py
index 7c059be4..4333761b 100644
--- a/helpdesk/urls.py
+++ b/helpdesk/urls.py
@@ -41,6 +41,10 @@ urlpatterns = patterns('helpdesk.views.staff',
'followup_edit',
name='helpdesk_followup_edit'),
+ url(r'^tickets/(?P[0-9]+)/followup_delete/(?P[0-9]+)/$',
+ 'followup_delete',
+ name='helpdesk_followup_delete'),
+
url(r'^tickets/(?P[0-9]+)/edit/$',
'edit_ticket',
name='helpdesk_edit'),
diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py
index a0b84a44..e1e410b7 100644
--- a/helpdesk/views/staff.py
+++ b/helpdesk/views/staff.py
@@ -139,7 +139,7 @@ def delete_ticket(request, ticket_id):
return HttpResponseRedirect(reverse('helpdesk_home'))
delete_ticket = staff_member_required(delete_ticket)
-def followup_edit(request, ticket_id, followup_id, ):
+def followup_edit(request, ticket_id, followup_id):
"Edit followup options with an ability to change the ticket."
followup = get_object_or_404(FollowUp, id=followup_id)
ticket = get_object_or_404(Ticket, id=ticket_id)
@@ -179,8 +179,21 @@ def followup_edit(request, ticket_id, followup_id, ):
attachment.followup = new_followup
attachment.save()
# delete old followup
- followup.delete()
+ followup.delete()
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
+
+
+def followup_delete(request, ticket_id, followup_id):
+ ''' followup delete for superuser'''
+
+ ticket = get_object_or_404(Ticket, id=ticket_id)
+ if not request.user.is_superuser:
+ return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
+
+ followup = get_object_or_404(FollowUp, id=followup_id)
+ followup.delete()
+ return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
+
def view_ticket(request, ticket_id):
ticket = get_object_or_404(Ticket, id=ticket_id)