#1278: MEDIA_URL needs to be accessible from templates
------------------------+---------------------------------------------------
Reporter: matt | Owner: adrian
Status: reopened | Component: Template system
Version: SVN | Resolution:
Keywords: | Stage: Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
------------------------+---------------------------------------------------
Changes (by Simon Litchfield <[EMAIL PROTECTED]>):
* cc: adrian (added)
* status: closed => reopened
* resolution: wontfix =>
* summary: Potentially useful get_setting templatetag => MEDIA_URL needs
to be accessible from templates
Comment:
As a new user, I was shocked and frustrated to find that MEDIA_URL wasn't
available in templates. And that you needed to write into every context,
or make a custom tag, or context_processor just to get it! It's a
seriously painful unnecessary complication and stumbling block for new
users. Now I've got RequestContext crap all through my code for no good
reason at all. What happened to DRY, less code is better? 99% of templates
need access to this setting.
Obviously we don't want template authors having access to all settings
though. Goes without saying.
Can I suggest either we select a few fundamentally important settings for
template authors, and make them available via {{ settings.MEDIA_URL }} or
even simply {{ MEDIA_URL }}. Or perhaps better still, to make it more
self-explanatory, maybe we define a list in settings.py --
Example --
TEMPLATE_SETTINGS = ['MEDIA_URL', 'GOOGLE_MAPS_KEY', 'SOME_OTHER_SETTING']
Or, if we prefer to be more specific --
TEMPLATE_CONTEXT_CONSTANTS = {'MEDIA_URL': MEDIA_URL, 'GOOGLE_MAPS_KEY':
GOOGLE_MAPS_KEY ... }
--
Ticket URL: <http://code.djangoproject.com/ticket/1278#comment:6>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---