python - Django-CKeditor: How to show RichTextFields in templates -


the problem want show content of post in template don't know how

the model of post is:

from ckeditor.fields import richtextfield  class post(models.model):      ...     content = richtextfield(verbose_name='contenido')     ... 

and in template have show post this:

{% post in posts %}     ...     {{ post.content }}     ... {% endfor %} 

but when see page in browser shows this: < p > post content < /p >

instead of this: post content

you need mark content safe. change template to:

{% post in posts %}     ...     {{ post.content|safe }}     ... {% endfor %} 

by default html not escaped , displayed text, why you're seeing <p> tags. need mark field safe django renders html. see documentation more info.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -