Django/Python: < comes up as < when I import it from the model object
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 < and <, 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<<<firefox-image>>></p>'
How can I get it to use the literal < and >?
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 <<firefox-image>>.
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.
加载中,请稍侯......
精彩评论