diff --git a/helpdesk/models.py b/helpdesk/models.py index 76cb8047..453b337d 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -372,13 +372,17 @@ class Ticket(models.Model): return u"%shelpdesk/priorities/priority%s.png" % (settings.MEDIA_URL, self.priority) get_priority_img = property(_get_priority_img) - def _get_priority_span(self): + def _get_priority_css_class(self): """ - A HTML providing a CSS_styled representation of the priority. + Return the boostrap class corresponding to the priority. """ - from django.utils.safestring import mark_safe - return mark_safe(u"%s" % (self.priority, self.priority)) - get_priority_span = property(_get_priority_span) + if self.priority == 2: + return "warning" + elif self.priority == 1: + return "danger" + else: + return "" + get_priority_css_class = property(_get_priority_css_class) def _get_status(self): """ diff --git a/helpdesk/templates/helpdesk/include/tickets.html b/helpdesk/templates/helpdesk/include/tickets.html index 410711ea..e83100cd 100644 --- a/helpdesk/templates/helpdesk/include/tickets.html +++ b/helpdesk/templates/helpdesk/include/tickets.html @@ -6,9 +6,9 @@ {% for ticket in ticket_list %} - + {{ ticket.ticket }} -{{ ticket.get_priority_span }} +{{ ticket.priority }} {{ ticket.title }} {{ ticket.queue }} {{ ticket.get_status }} @@ -18,4 +18,4 @@ {{ ticket_list_empty_message }} {% endif %}{% endfor %} - \ No newline at end of file + diff --git a/helpdesk/templates/helpdesk/include/unassigned.html b/helpdesk/templates/helpdesk/include/unassigned.html index 3053e31b..9942eb2b 100644 --- a/helpdesk/templates/helpdesk/include/unassigned.html +++ b/helpdesk/templates/helpdesk/include/unassigned.html @@ -6,9 +6,9 @@ {% for ticket in unassigned_tickets %} - + {{ ticket.ticket }} -{{ ticket.get_priority_span }} +{{ ticket.priority }} {{ ticket.title }} {{ ticket.queue }} {{ ticket.created|naturaltime }} @@ -18,4 +18,4 @@ {% trans "There are no unassigned tickets." %} {% endfor %} - \ No newline at end of file + diff --git a/helpdesk/templates/helpdesk/ticket_list.html b/helpdesk/templates/helpdesk/ticket_list.html index 521505f2..2341037a 100644 --- a/helpdesk/templates/helpdesk/ticket_list.html +++ b/helpdesk/templates/helpdesk/ticket_list.html @@ -224,10 +224,10 @@ $(document).ready(function() { {% for ticket in tickets.object_list %} - + {{ ticket.ticket }} -{{ ticket.get_priority_span }} +{{ ticket.priority }} {{ ticket.title }} {{ ticket.queue }} {{ ticket.get_status }} diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 73f88283..1aaae4cc 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -45,10 +45,7 @@ if helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE: # treat 'normal' users like 'staff' staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active) else: - try: - from django.contrib.admin.views.decorators import staff_member_required - except: - staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_staff) + staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_staff) superuser_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_superuser)