Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

how do i get django cms editor to work inside djangos default tags

I am building a django app that would allow users to create html content (to be used as an email template), but keep getting TemplateSyntaxError.

I am trying to use the django-cms plugins in my own view and templates any ideas.


{% 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 %}


but i get this error:

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
question from:https://stackoverflow.com/questions/65645573/how-do-i-get-django-cms-editor-to-work-inside-djangos-default-tags

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I figured out a way to get the functionalities i wanted using iframes in my templates

<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)

I apologize for posting an answer without the required number of reps. just thought it'd be helpful to someone else


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...