Merge pull request #380 from powderflask/Fix-user_admin_url

Fix: _meta.module_name deprecated in django1.8
This commit is contained in:
Ross Poulton 2016-01-29 10:23:22 +11:00
commit b8c08b7699

View File

@ -14,8 +14,13 @@ from django.contrib.auth import get_user_model
def user_admin_url(action):
user = get_user_model()
try:
model_name = user._meta.module_name.lower()
except AttributeError: # module_name alias removed in django 1.8
model_name = user._meta.model_name.lower()
return 'admin:%s_%s_%s' % (
user._meta.app_label, user._meta.module_name.lower(),
user._meta.app_label, model_name,
action)
register = template.Library()