Django-ckeditor not displaying correctly in html

只愿长相守 提交于 2019-12-10 22:06:35

问题


I have a little problem, I installed Django-ckeditor in my admin section. I can perfectly use it in Admin, but when I display on the Html page it is not showing correctly, I'll put some image to have a better visual.

Here is my admin ckeditor, works perfectly!

Here is my html page, where the ckeditor don't works correctly

How Can I resolve this issue ? (I use python 2.7.4 and Django 1.7.4)


回答1:


When rendering html in templates, make sure you mark it as safe...

{{ article.content|safe }}

See documentation:

https://docs.djangoproject.com/en/1.7/ref/templates/builtins/#safe




回答2:


For me the problem was that I was just writing

{{form.as_p}}

Instead use-

<form method="POST" enctype="multipart/form-data">
  {% csrf_token %}
  {{form.media}}     //this was missing 
  {{form.as_p}}



回答3:


Whether Its tinymce, ace editor or ck Editor not showing / working: try:

1)python manage.py collectstatic

2)python manage.py makemigrations and python manage.py migrate

3) {% csrf_token %} {{form.media}}

{{form.Text_areas_name}}



来源:https://stackoverflow.com/questions/28915977/django-ckeditor-not-displaying-correctly-in-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!