Fix: _meta.module_name deprecated in django1.8

This commit is contained in:
powderflask 2016-01-23 12:25:17 -08:00
parent 4347d1ec61
commit 8bf3449719

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