Fix user changelist for custom user models

Fixed the user_admin_changelist url for custom user models.
This commit is contained in:
Tom Graham 2014-10-22 17:23:56 +11:00
parent d2ac8af6c0
commit d966172fb7
2 changed files with 24 additions and 2 deletions

View File

@ -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 %} {% block helpdesk_title %}{% trans "Change System Settings" %}{% endblock %}
@ -14,6 +14,6 @@
<li><a href='{% url 'admin:helpdesk_kbcategory_changelist' %}'>{% trans "Maintain Knowledgebase Categories" %}</a></li> <li><a href='{% url 'admin:helpdesk_kbcategory_changelist' %}'>{% trans "Maintain Knowledgebase Categories" %}</a></li>
<li><a href='{% url 'admin:helpdesk_kbitem_changelist' %}'>{% trans "Maintain Knowledgebase Items" %}</a></li> <li><a href='{% url 'admin:helpdesk_kbitem_changelist' %}'>{% trans "Maintain Knowledgebase Items" %}</a></li>
<li><a href='{% url 'admin:helpdesk_emailtemplate_changelist' %}'>{% trans "Maintain E-Mail Templates" %}</a></li> <li><a href='{% url 'admin:helpdesk_emailtemplate_changelist' %}'>{% trans "Maintain E-Mail Templates" %}</a></li>
<li><a href='{% url 'admin:auth_user_changelist' %}'>{% trans "Maintain Users" %}</a></li> <li><a href='{% url 'changelist'|user_admin_url %}'>{% trans "Maintain Users" %}</a></li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -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)