我正在尝试将上下文处理器中的变量放入标签模板“extends”中:
{% extends {{ base_template|default:"mainpage.html" }} %}
但是我遇到了一个异常:
Exception Value: 'extends' takes one argument
我的context_processors.py文件:
from django.conf import settings
def search(request):
"""Adds settings for test"""
return {
'base_template' : settings.BASE_TEMPLATE,
}
还有settings.py:
...
BASE_TEMPLATE = "test/base.html"
...
你能帮我翻译一下吗?谢谢!