我有两个文件,base.html
和homepage.html
. Homepage 扩展 base,并添加到 block extra
。Base 应该在 body 内的 span 中渲染块extra
,但不会。
base.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>
主页.html:
{% extends 'base.html' %}
{% load sekizai_tags %}
{% block 'content' %}
<p>that's some sweet content ya got there lad</p>
{% addtoblock "extra" %}wow{% endaddtoblock %}
{% endblock %}
和输出:
我错过了什么真正简单的事情?