Wednesday, 15 April 2015

html - django weird behavior with safe filter -



html - django weird behavior with safe filter -

first, @ code:

... <p class="entry-content">{{ entry.content|safe }}</p> ...

the problem renders this:

... <p class="entry-content"></p> {{ entry.content|safe }} ...

however, when utilize div tag instead of p works alright.

why happen , there way prepare without javascript?

edit: problem occurs when {{ entry.content }} has block tags div. edit2: in console works fine. problem occurs in browser only.

i think figured out. turns out p tag cannot contain block elements. found here: python lxml changes tag hierarchy?

the solution utilize div instead of p , fine.

html django django-templates django-template-filters

No comments:

Post a Comment