django contrib admin templatetags app_tags py from django import templ

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#django/contrib/admin/templatetags/app_tags.py
from django import template
register = template.Library()
def my_app_name(app_name):
try:
app = __import__(app_name.lower())
return app.app_label
except:
return app_name
my_app_name = register.simple_tag(my_app_name)