【发布时间】:2017-01-04 13:48:48
【问题描述】:
我有以下代码:
base.html
<html>
...
{% block test_block %}
{# Some stuff to render #}
{% endblock %}
...
</html>
main_template.html
{% extends "base.html" %}
...
{% block content %}
{% placeholder "content" %}
{% endblock %}
...
plugin.html
...
如果我将我的插件添加到它在占位符块中呈现的页面,正如预期的那样。
如果我修改 plugin.html 以添加以下内容:
plugin.html
...
{% block test_block %}
{{ block.super }}
{# Some more stuff to render #}
{% endblock %}
...
然后我收到一个错误:
'BlockNode' 对象没有属性 'context'。您是否在基本模板中使用了 {{ block.super }}?
如果我尝试从 plugin.html 中扩展 main_template.html 或 CMS_TEMPLATE(它们似乎相同?),我会收到以下错误:
调用 Python 对象时超出最大递归深度
如何从我的插件中访问并附加到 test_block?
【问题讨论】:
-
插件是从什么扩展而来的?
-
据我所知,没有。 plugin.html 顶部没有 {% extends %} 标记,但添加一个会导致最大递归深度错误
标签: django django-cms