Make django-wysiwyg work on django pages

故事扮演 提交于 2020-01-05 08:35:27

问题


I have a TextField for description on one of my forms, and i want to apply reich text editor for that so tried to use this package, but i am unable to make it work

below are my settings

settings.py

INSTALLED_APPS = (
    .....
    ..... 
    # Description Rich text editor settings
    'tinymce',
    'django_wysiwyg',
)

DJANGO_WYSIWYG_FLAVOR = "tinymce"

template.html

{% extends "base.html" %}
{% load wysiwyg %}
{% wysiwyg_setup %}

<form enctype="multipart/form-data" action="{% url 'product_create' %}" method="post">

    <div class="marg_tp38 span12">
         {{product_form.name}}
         {% wysiwyg_editor 'id_name' %}
    </div>
    <div class="marg_tp38 span12">
         {{product_form.description}}
         {% wysiwyg_editor 'inputdescription_id' %}
    </div>
</form>

So above are my settings that i have used, but i could n't able to make that work, can anyone please let me know what am i missing ? and what should be done in order to make it work ?


回答1:


  • Move {% wysiwyg_setup %} in head section

  • Make sure you have copied tinymce in static folder, and set correct path for DJANGO_WYSIWYG_MEDIA_URL in settings as mentioned on documentation.



来源:https://stackoverflow.com/questions/20097929/make-django-wysiwyg-work-on-django-pages

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