From d2ac8af6c0d894af26134be5a4e189f4935a37ee Mon Sep 17 00:00:00 2001 From: Tom Graham Date: Wed, 22 Oct 2014 16:18:04 +1100 Subject: [PATCH 01/35] Improved support for custom user models Support for custom user models with a non-standard username field --- helpdesk/forms.py | 4 ++-- helpdesk/models.py | 2 +- helpdesk/templates/helpdesk/base.html | 2 +- helpdesk/templates/helpdesk/navigation.html | 4 ++-- helpdesk/templates/helpdesk/rss_list.html | 4 ++-- helpdesk/templates/helpdesk/ticket_list.html | 6 +++--- helpdesk/tests/navigation.py | 2 +- helpdesk/views/api.py | 2 +- helpdesk/views/feeds.py | 14 +++++++------- helpdesk/views/staff.py | 14 +++++++------- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/helpdesk/forms.py b/helpdesk/forms.py index eb0dde3f..423a3781 100644 --- a/helpdesk/forms.py +++ b/helpdesk/forms.py @@ -529,9 +529,9 @@ class TicketCCForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(TicketCCForm, self).__init__(*args, **kwargs) if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_CC: - 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) self.fields['user'].queryset = users class Meta: model = TicketCC diff --git a/helpdesk/models.py b/helpdesk/models.py index 453b337d..cbd42e5d 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -351,7 +351,7 @@ class Ticket(models.Model): if self.assigned_to.get_full_name(): return self.assigned_to.get_full_name() else: - return self.assigned_to.username + return self.assigned_to.get_username() get_assigned_to = property(_get_assigned_to) def _get_ticket(self): diff --git a/helpdesk/templates/helpdesk/base.html b/helpdesk/templates/helpdesk/base.html index 9ef38d9c..71ad129e 100644 --- a/helpdesk/templates/helpdesk/base.html +++ b/helpdesk/templates/helpdesk/base.html @@ -17,7 +17,7 @@ - + diff --git a/helpdesk/templates/helpdesk/navigation.html b/helpdesk/templates/helpdesk/navigation.html index 59bc3f0d..ff3fae31 100644 --- a/helpdesk/templates/helpdesk/navigation.html +++ b/helpdesk/templates/helpdesk/navigation.html @@ -26,13 +26,13 @@ {% for q in user_saved_queries_ %}
  • {{ q.title }} {% if q.shared %} - (Shared{% ifnotequal user q.user %} by {{ q.user.username }}{% endifnotequal %}) + (Shared{% ifnotequal user q.user %} by {{ q.user.get_username }}{% endifnotequal %}) {% endif %}
  • {% endfor %} {% endif %} -