On 29/09/10 09:34, Benedict Verheyen wrote: > In my template i add this: > <link rel="stylesheet" type="text/css" > href="{{MEDIA_URL_CALLTRACKING}}/style/login.css" /> >
(I'd favour prefix rather than suffix if you're going to pseudo-namespace) Did you introduce such a MEDIA_URL_CALLTRACKING variable into the template context by any means? It's not automatic. For MEDIA_URL, the value in your settings is propagated into the template context by django.core.context_processors.media, which you'll see is a TEMPLATE_CONTEXT_PROCESSORS entry in settings.py If you want to duplicate that functionality for another variable, it's straightforward enough to write a template context processor to do that if you want to, see source. http://code.djangoproject.com/browser/django/trunk/django/core/context_processors.py#L69 n.b. template context processors only work for RequestContext contexts, which not everything uses (obviously for your own apps you can just make sure to use them). FWIW, that's not the pattern the admin contrib follows, it uses a custom template tag library that includes a custom tag that resolves to the admin media prefix, so its templates do a {% load adminmedia %} to load the tag library then they use "{% admin_media_prefix %}blah/blah" http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templatetags/adminmedia.py I have no particular opinion on what approach is better, both work. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.