From d966172fb787df96f8917eec3290438bfa0b7fd7 Mon Sep 17 00:00:00 2001 From: Tom Graham Date: Wed, 22 Oct 2014 17:23:56 +1100 Subject: [PATCH] Fix user changelist for custom user models Fixed the user_admin_changelist url for custom user models. --- .../templates/helpdesk/system_settings.html | 4 ++-- helpdesk/templatetags/user_admin_url.py | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 helpdesk/templatetags/user_admin_url.py diff --git a/helpdesk/templates/helpdesk/system_settings.html b/helpdesk/templates/helpdesk/system_settings.html index bead3bdb..311b8d96 100644 --- a/helpdesk/templates/helpdesk/system_settings.html +++ b/helpdesk/templates/helpdesk/system_settings.html @@ -1,4 +1,4 @@ -{% extends "helpdesk/base.html" %}{% load i18n %}{% load url from future %} +{% extends "helpdesk/base.html" %}{% load i18n %}{% load url from future %}{% load user_admin_url %} {% block helpdesk_title %}{% trans "Change System Settings" %}{% endblock %} @@ -14,6 +14,6 @@
  • {% trans "Maintain Knowledgebase Categories" %}
  • {% trans "Maintain Knowledgebase Items" %}
  • {% trans "Maintain E-Mail Templates" %}
  • -
  • {% trans "Maintain Users" %}
  • +
  • {% trans "Maintain Users" %}
  • {% endblock %} diff --git a/helpdesk/templatetags/user_admin_url.py b/helpdesk/templatetags/user_admin_url.py new file mode 100644 index 00000000..fb7bc95a --- /dev/null +++ b/helpdesk/templatetags/user_admin_url.py @@ -0,0 +1,22 @@ +""" +django-helpdesk - A Django powered ticket tracker for small enterprise. + +(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details. + +templatetags/admin_url.py - Very simple template tag allow linking to the + right auth user model urls. + +{% url 'changelist'|user_admin_url %} +""" + +from django import template +from django.contrib.auth import get_user_model + +def user_admin_url(action): + user = get_user_model() + return 'admin:%s_%s_%s' % ( + user._meta.app_label, user._meta.model_name, + action) + +register = template.Library() +register.filter(user_admin_urlname)