Converted django.contrib.admin.templatetags.adminmedia to use simple_tag decorator

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-11-25 01:00:52 +00:00
parent c5e5c0fc35
commit 16da4e69c4
1 changed files with 8 additions and 16 deletions

View File

@ -1,17 +1,9 @@
from django.core import template from django.core.template.decorators import simple_tag
class AdminMediaPrefixNode(template.Node): def admin_media_prefix():
def render(self, context): try:
try: from django.conf.settings import ADMIN_MEDIA_PREFIX
from django.conf.settings import ADMIN_MEDIA_PREFIX except ImportError:
except ImportError: return ''
return '' return ADMIN_MEDIA_PREFIX
return ADMIN_MEDIA_PREFIX admin_media_prefix = simple_tag(admin_media_prefix)
def admin_media_prefix(parser, token):
"""
{% admin_media_prefix %}
"""
return AdminMediaPrefixNode()
template.register_tag('admin_media_prefix', admin_media_prefix)