【发布时间】:2021-04-15 03:20:30
【问题描述】:
我正在构建一个 django 应用程序,它允许用户创建 html 内容(用作电子邮件模板),但不断收到 TemplateSyntaxError。
我正在尝试在我自己的视图中使用 django-cms 插件并模板化任何想法。
{% extends 'admin/merchant/base.html' %}
{% load cache %}
{% load cms_tags %}
{% block extra_head %}
{% placeholder "css" %}
{% endblock extra_head %}
{% block content %}
<body>
{% cms_toolbar %}
{% placeholder "content" or %} Nothing is coming through... {% endplaceholder %}
</body>
{% endblock content %}
但我收到此错误:
Template error:
In template /home/joel/Projects/Vendora Deploy/src/templates/admin/merchant/newsletter/create-page.html, error at line 15
Invalid block tag on line 15: 'endblock'. Did you forget to register or load this tag?
5 : {% block extra_head %}
6 : {% placeholder "css" %}
7 : {% endblock extra_head %}
8 :
9 : {% block content %}
10 : <body>
11 : {% cms_toolbar %}
12 :
13 : {% placeholder "content" or %} Nothing is coming through... {% endplaceholder %}
14 : </body>
15 : {% endblock content %}
16 :
17 :
18 : ```
[1]:[Traceback Image][1] https://i.stack.imgur.com/PkHi9.png
【问题讨论】:
-
检查内容是否在您的主模板中
-
你能分享你的admin/merchant/base.html吗?
-
是的,我的 base.html 中有它
-
整件事?超过 300 行
-
@EricMartin 基本上我想要的是仅在保留我的基本导航和内容(如果可能的话)的同时使用该模板中的 cms 编辑功能,所有其他模板都可以正常工作。
标签: django django-cms