Ticket #346: mediaurl.py

File mediaurl.py, 423 bytes (added by slashzero, 19 years ago)

Here's a meda_url_prefix template tag

Line 
1from django.core import template
2
3class MediaURLPrefixNode(template.Node):
4 def render(self, context):
5 try:
6 from django.conf.settings import MEDIA_URL
7 except ImportError:
8 return ''
9 return MEDIA_URL
10
11def media_url_prefix(parser, token):
12 """
13 {% media_url_prefix %}
14 """
15 return MediaURLPrefixNode()
16
17template.register_tag('media_url_prefix', media_url_prefix)
Back to Top