At first I thought it was the wysiwyg editors fault I had to try different ones. But turns out they all return contents with html tag...so it must be me. I'm using https://github.com/douglasmiranda/django-wysiwyg-redactor and this also returns with html tag. ex: if I type hello it returns <p>hello</p>
so I tried safe filtering and some other filtering but none of them works. how do I fix this? Thanks in advance
起初我以为是我不得不尝试不同的编辑错误。但事实证明他们都返回带有html标签的内容......所以一定是我。我正在使用https://github.com/douglasmiranda/django-wysiwyg-redactor,这也会返回html标签。例如:如果我输入hello它返回
hello ,所以我尝试了安全过滤和其他一些过滤,但它们都不起作用。我该如何解决?提前致谢
{% block content %}
<form id="post_form" method="post" action="/add_post/" enctype="multipart/form-data">
{% csrf_token %}
{{ form |crispy|safe }}
<input type="submit" name="submit" value="Create Post">
</form>
{% endblock %}
I also tried {{form|safe}}
which doesn't work...and I want to use crispy as well.
我也试过了{{form | safe}}这个不起作用......我也想要使用crispy。
1 个解决方案
#1
0
After I read the docs I've found this one:
在我阅读了文档后,我发现了这个:
data = django_wysiwyg.clean_html(data)
Try it, I hope it works...
尝试一下,我希望它有效......
EDIT:
{{ form |crispy|safe }}
{{form | crispy | safe}}
This outputs the RAW Html, this is what you don't want I guess...
这输出RAW Html,这是你不想要的我猜...
#1
0
After I read the docs I've found this one:
在我阅读了文档后,我发现了这个:
data = django_wysiwyg.clean_html(data)
Try it, I hope it works...
尝试一下,我希望它有效......
EDIT:
{{ form |crispy|safe }}
{{form | crispy | safe}}
This outputs the RAW Html, this is what you don't want I guess...
这输出RAW Html,这是你不想要的我猜...