开发者

Django/Python: < comes up as &lt; when I import it from the model object

开发者 https://www.devze.com 2022-12-20 15:37 出处:网络
Revised question: In my dbms, I\'m storing the literal <<<firefox-image>>>, I confirmed in Navicat and Mysql CLI that its <<<firefox-image>>>. When I use the Pytho

Revised question:

In my dbms, I'm storing the literal <<<firefox-image>>>, I confirmed in Navicat and Mysql CLI that its <<<firefox-image>>>. When I use the Python shell and try to grab the same article entry, the outer <>'s get converted to &lt; and &lt;, respectively.

Snippet of me testing:

>>> entry = Entry.objects.filter( pub_date__lte = datetime.datetime.now() ).filter(featured=1)[0].excerpt_html
>>> entry
u'<p>\u0432\u0430\u043d.\n&lt;&lt;<firefox-image>&gt;&gt;</p>'

How can I get it to use the literal < and >?

Original question:

In my template I did this:

{{ entry.excerpt_html|safe|render_uploads }}

it complained at the render_uploads because I didnt load adminfiles, so I prepended

{% load 开发者_如何学Goadminfiles_tags %}

The error went away, but in my article excerpt it still renders <<<firefox-image>>> as &lt;&lt;firefox-image&gt;&gt;.


I'm a dumbass - I forgot to invoke render_uploads before storing it.

return markdown(render_uploads(markup))


I can't duplicate that symptom; the fact that you have only two less-than and greater-thans on each side makes me wonder if your inline syntax is wrong? Are there definitely three on either side in your content area?

Otherwise, I think I'd need to see more of the relevant code.

0

精彩评论

暂无评论...
验证码 换一张
取 消