mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-24 16:44:50 +00:00
Prevent {{ STATIC_URL }} from being used in templates
This commit is contained in:
parent
57fd4656fd
commit
f2b4ac9753
2 changed files with 9 additions and 0 deletions
7
wagtail/tests/context_processors.py
Normal file
7
wagtail/tests/context_processors.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
def do_not_use_static_url(request):
|
||||
def exception():
|
||||
raise Exception("Do not use STATIC_URL in templates. Use the {% static %} templatetag instead.")
|
||||
|
||||
return {
|
||||
'STATIC_URL': lambda: exception(),
|
||||
}
|
||||
|
|
@ -48,6 +48,7 @@ if django.VERSION >= (1, 8):
|
|||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'django.template.context_processors.request',
|
||||
'wagtail.tests.context_processors.do_not_use_static_url',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
@ -55,6 +56,7 @@ if django.VERSION >= (1, 8):
|
|||
else:
|
||||
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
|
||||
'django.core.context_processors.request',
|
||||
'wagtail.tests.context_processors.do_not_use_static_url',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
|
|
|
|||
Loading…
Reference in a new issue