`render_block`在sekizai中没有渲染任何东西

时间:2016-08-04 13:58:01

标签: django django-cms django-sekizai

我有两个文件,location = 'cat' # Notice the location with braces, and the one without. html = '<input value="{location}" name="location" type="text" />' print(html.format(location = location)) # outputs <input value="cat" name="location" type="text" /> # the location with braces is replaced. base.html。主页扩展了基础,并添加到块homepage.html。 Base应该在正文中的范围内渲染块extra,但不会。

base.html文件:

extra

homepage.html:

{% load sekizai_tags %}

<!doctype html>
<html>
    <head>
        <title>Title</title>
    </head>
    <body>
        <span style="color: red;">{% render_block "extra" %}</span>
        {% block 'content' %}
        {% endblock %}
    </body>
</html>

输出:

Just the <p>, the <span> is empty.

我错过了什么非常简单的事情?

1 个答案:

答案 0 :(得分:0)

啊哈,我错过了模板中的上下文预处理器。

'sekizai.context_processors.sekizai',