From 978c0665b869101fbcaf1cf75e696a7f1b3345c5 Mon Sep 17 00:00:00 2001 From: Issac Kelly Date: Tue, 15 Jul 2014 14:02:31 -0700 Subject: [PATCH 1/3] Custom User model changes. --- helpdesk/urls.py | 6 +++--- helpdesk/views/staff.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/helpdesk/urls.py b/helpdesk/urls.py index 9ea4fb99..caa1d3f5 100644 --- a/helpdesk/urls.py +++ b/helpdesk/urls.py @@ -160,11 +160,11 @@ urlpatterns += patterns('helpdesk.views.public', ) urlpatterns += patterns('', - url(r'^rss/user/(?P[\.\@A-Za-z0-9_-]+)/$', + url(r'^rss/user/(?P[^/]+)/$', login_required(feeds.OpenTicketsByUser()), name='helpdesk_rss_user'), - - url(r'^rss/user/(?P[\.\@A-Za-z0-9_-]+)/(?P[A-Za-z0-9_-]+)/$', + + url(r'^rss/user/(?P[^/]+)/(?P[A-Za-z0-9_-]+)/$', login_required(feeds.OpenTicketsByUser()), name='helpdesk_rss_user_queue'), diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 0a8a33cf..e491c2d8 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -237,9 +237,9 @@ def view_ticket(request, ticket_id): return update_ticket(request, ticket_id) if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_OWNERS: - users = User.objects.filter(is_active=True, is_staff=True).order_by('username') + users = User.objects.filter(is_active=True, is_staff=True).order_by(User.USERNAME_FIELD) else: - users = User.objects.filter(is_active=True).order_by('username') + users = User.objects.filter(is_active=True).order_by(User.USERNAME_FIELD) # TODO: shouldn't this template get a form to begin with? From 19c19132688e0ca812666e4869e2ac54731fc4c9 Mon Sep 17 00:00:00 2001 From: Issac Kelly Date: Tue, 15 Jul 2014 15:48:42 -0700 Subject: [PATCH 2/3] Allow Templated Subjects. --- docs/settings.rst | 4 ++++ helpdesk/lib.py | 2 +- helpdesk/settings.py | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index 38bb35fb..b6a5f03b 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -86,6 +86,10 @@ These changes are visible throughout django-helpdesk **Default:** ``HELPDESK_AUTO_SUBSCRIBE_ON_TICKET_RESPONSE = False`` +- **HELPDESK_EMAIL_SUBJECT_TEMPLATE ** Subject template for templated emails. ``%(subject)s`` represents the subject wording from the email template (e.g. "(Closed)"). + + **Default:** ``HELPDESK_EMAIL_SUBJECT_TEMPLATE = "{{ ticket.ticket }} {{ ticket.title|safe }} %(subject)s"`` + Options shown on public pages ----------------------------- diff --git a/helpdesk/lib.py b/helpdesk/lib.py index 39bc3074..0b66da41 100644 --- a/helpdesk/lib.py +++ b/helpdesk/lib.py @@ -104,7 +104,7 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b ).render(context) subject_part = loader.get_template_from_string( - "{{ ticket.ticket }} {{ ticket.title|safe }} %s" % t.subject + settings.HELPDESK_EMAIL_SUBJECT_TEMPLATE % t.subject ).render(context) if isinstance(recipients,(str,unicode)): diff --git a/helpdesk/settings.py b/helpdesk/settings.py index 20140721..52fb4900 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -80,6 +80,9 @@ HELPDESK_STAFF_ONLY_TICKET_OWNERS = getattr(settings, 'HELPDESK_STAFF_ONLY_TICKE HELPDESK_STAFF_ONLY_TICKET_CC = getattr(settings, 'HELPDESK_STAFF_ONLY_TICKET_CC', False) +# allow the subject to have a configurable template. +HELPDESK_EMAIL_SUBJECT_TEMPLATE = getattr(settings, 'HELPDESK_EMAIL_SUBJECT_TEMPLATE', "{{ ticket.ticket }} {{ ticket.title|safe }} %(subject)s") + ''' options for staff.create_ticket view ''' # hide the 'assigned to' / 'Case owner' field from the 'create_ticket' view? From 073df0b03e4316cf8e50a75cc2c570cebd739469 Mon Sep 17 00:00:00 2001 From: Issac Kelly Date: Tue, 15 Jul 2014 16:04:19 -0700 Subject: [PATCH 3/3] Continuation --- helpdesk/lib.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/helpdesk/lib.py b/helpdesk/lib.py index 0b66da41..3188c9c0 100644 --- a/helpdesk/lib.py +++ b/helpdesk/lib.py @@ -104,8 +104,9 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b ).render(context) subject_part = loader.get_template_from_string( - settings.HELPDESK_EMAIL_SUBJECT_TEMPLATE % t.subject - ).render(context) + settings.HELPDESK_EMAIL_SUBJECT_TEMPLATE % { + "subject": t.subject, + }).render(context) if isinstance(recipients,(str,unicode)): if recipients.find(','):