Created
July 26, 2009 19:22
-
-
Save mihasya/155894 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#make some settings accessible via settings.FOO from within templates | |
from django.conf import settings | |
def exposed_settings(request): | |
context_settings = dict() | |
for x in settings.TEMPLATE_CONTEXT_SETTINGS: | |
context_settings[x] = getattr(settings, x) | |
return { 'settings': context_settings } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEMPLATE_CONTEXT_PROCESSORS += ( | |
"myapp.context_processors.exposed_settings", | |
) | |
TEMPLATE_CONTEXT_SETTINGS = ( | |
'MEDIA_URL', | |
'ADMIN_MEDIA_PREFIX', | |
'LANGUAGE_CODE', | |
#whatever other settings you want to show up in your templates | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment