From 041272ce1b04d60166d379ea1f9f65c07957450f Mon Sep 17 00:00:00 2001 From: Ross Poulton Date: Sun, 20 Jan 2008 23:31:27 +0000 Subject: [PATCH] * Added ability for tickets to be placed on hold --- models.py | 2 +- templates/helpdesk/dashboard.html | 2 +- templates/helpdesk/public_view_ticket.html | 8 ++++---- templates/helpdesk/ticket.html | 10 +++++----- templates/helpdesk/ticket_list.html | 2 +- templatetags/ticket_to_link.py | 2 ++ views.py | 5 +++-- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/models.py b/models.py index 0a02fd63..34500c49 100644 --- a/models.py +++ b/models.py @@ -164,7 +164,7 @@ class Ticket(models.Model): def _get_status(self): held_msg = '' if self.on_hold: held_msg = ' - On Hold' - return '%s%s' % (self.get_status_display, held_msg) + return '%s%s' % (self.get_status_display(), held_msg) get_status = property(_get_status) def _get_ticket_url(self): diff --git a/templates/helpdesk/dashboard.html b/templates/helpdesk/dashboard.html index 948640b8..e4041784 100644 --- a/templates/helpdesk/dashboard.html +++ b/templates/helpdesk/dashboard.html @@ -25,7 +25,7 @@ Priority {{ ticket.priority }} {{ ticket.title }} {{ ticket.queue }} -{{ ticket.get_status_display }} +{{ ticket.get_status }} {{ ticket.modified|timesince }} {% endfor %} diff --git a/templates/helpdesk/public_view_ticket.html b/templates/helpdesk/public_view_ticket.html index 96ac5e43..f832027f 100644 --- a/templates/helpdesk/public_view_ticket.html +++ b/templates/helpdesk/public_view_ticket.html @@ -51,13 +51,13 @@ {% load ticket_to_link %} {% for followup in ticket.followup_set.public_followups %}
-
{{ followup.title }}
+
{{ followup.title }}
{{ followup.comment|num_to_link }} -{% if followup.ticketchange_set.all %}
+{% if followup.ticketchange_set.all %}
    {% for change in followup.ticketchange_set.all %} -Changed {{ change.field }} from {{ change.old_value }} to {{ change.new_value }}.
    +
  • Changed {{ change.field }} from {{ change.old_value }} to {{ change.new_value }}.
  • {% endfor %} -
{% endif %} +
{% endif %}
{% endfor %} {% endif %} diff --git a/templates/helpdesk/ticket.html b/templates/helpdesk/ticket.html index c3c6e5c4..60911727 100644 --- a/templates/helpdesk/ticket.html +++ b/templates/helpdesk/ticket.html @@ -69,13 +69,13 @@ {% load ticket_to_link %} {% for followup in ticket.followup_set.all %}
-
{{ followup.title }}
-{{ followup.comment|num_to_link }} -{% if followup.ticketchange_set.all %}
+
{{ followup.title }}
+{% if followup.comment %}{{ followup.comment|num_to_link }}{% endif %} +{% if followup.ticketchange_set.all %}
    {% for change in followup.ticketchange_set.all %} -Changed {{ change.field }} from {{ change.old_value }} to {{ change.new_value }}.
    +
  • Changed {{ change.field }} from {{ change.old_value }} to {{ change.new_value }}.
  • {% endfor %} -
{% endif %} +
{% endif %}
{% endfor %} {% endif %} diff --git a/templates/helpdesk/ticket_list.html b/templates/helpdesk/ticket_list.html index 9a227036..a5d5a175 100644 --- a/templates/helpdesk/ticket_list.html +++ b/templates/helpdesk/ticket_list.html @@ -63,7 +63,7 @@ Priority {{ ticket.priority }} {{ ticket.title }} {{ ticket.queue }} -{{ ticket.get_status_display }} +{{ ticket.get_status }} {{ ticket.created|timesince }} ago {{ ticket.get_assigned_to }} diff --git a/templatetags/ticket_to_link.py b/templatetags/ticket_to_link.py index 339f016b..6d216fd0 100644 --- a/templatetags/ticket_to_link.py +++ b/templatetags/ticket_to_link.py @@ -42,6 +42,8 @@ class ReverseProxy: yield self.sequence[i] def num_to_link(text): + if text == '': + return text import re from django.core.urlresolvers import reverse diff --git a/views.py b/views.py index b76be6ef..98bca6b2 100644 --- a/views.py +++ b/views.py @@ -309,16 +309,17 @@ def hold_ticket(request, ticket_id, unhold=False): if unhold: ticket.on_hold = False - title = 'Ticket placed on hold' + title = 'Ticket taken off hold' else: ticket.on_hold = True - title = 'Ticket taken off hold' + title = 'Ticket placed on hold' f = FollowUp( ticket = ticket, user = request.user, title = title, date = datetime.now(), + public = True, ) f.save()