#3818: Expose chosen settings to default context processor.
---------------------------------------------+------------------------------
Reporter: [email protected] | Owner: adrian
Status: reopened | Milestone:
Component: Core framework | Version: SVN
Resolution: | Keywords: expose_settings
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by [email protected]):
* status: closed => reopened
* resolution: duplicate =>
Comment:
I don't think this is a duplicate of the MEDIA_URL ticket.
I think that it would simplify some development scenarios to be able to
expose selected settings in the templates instead of having to write one-
off context processors for every single one. This seems particularly
useful for people who have custom settings. My usecase for this is a
Google Analytics ID - I don't want GA to fire while I'm doing testing on
my dev machine, so my dev settings.py has GA_ID set to "FOO" while the
prod on has the real ID, and in my template I simply have {{
settings.GA_ID }}
I'm attaching a patch that is similar to the original one, with two
differences:
1. settings are placed in a context dict named 'settings' to avoid
collisions and to improve readability, so a setting would be accessed from
the template as {{ settings.FOO }}
2. I've added the suggested defaults to global_settings.py
--
Ticket URL: <http://code.djangoproject.com/ticket/3818#comment:3>
Django <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
-~----------~----~----~----~------~----~------~--~---