mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 17:47:08 +03:00
Add context processor for settings variables
This allows for usage of settings variables in templates, e.g ``` {% if settings.USE_ANALYTICS %} <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ settings.GOOGLE_TAG_MANAGER_ID }}" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> {% endif %} ```
This commit is contained in:
parent
baab918874
commit
69566f5456
|
@ -187,6 +187,7 @@ TEMPLATES = [
|
|||
"django.template.context_processors.static",
|
||||
"django.template.context_processors.tz",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"{{ cookiecutter.project_slug }}.utils.context_processors.settings_context",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
from django.conf import settings
|
||||
|
||||
|
||||
def settings_context(_request):
|
||||
return {"settings": settings}
|
Loading…
Reference in New Issue
Block a user