问题描述
我正在构建一个 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
解决方法
我找到了一种方法,可以在我的模板中使用 iframe 来获得我想要的功能
<iframe src="{% url 'vendor:cms-index' %} width="100%" height="80%" />
def cms_index_view(request,*args,**kwargs):
from cms.page_rendering import _render_welcome_page
return _render_welcome_page(request)
我很抱歉在没有所需代表数量的情况下发布答案。只是认为这对其他人有帮助