Last active
August 29, 2015 14:21
-
-
Save akobashikawa/e29caee5e31bdbfa712c to your computer and use it in GitHub Desktop.
Django tag to publish some settings value in template
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
# based upon ideas in http://stackoverflow.com/a/6343321 | |
@register.simple_tag(takes_context=True) | |
def settings_value(context, name): | |
PUBLIC_SETTINGS_NAMES = ("THEME_DEBUG",) | |
if name in PUBLIC_SETTINGS_NAMES: | |
context[name] = getattr(settings, name, "") | |
return '' | |
return '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With PUBLIC_SETTINGS_NAMES in settings: