python - django-markupfield returns string -


i'm trying set django app has markupfield in it's model, this:

from django.db import models markupfield.fields import markupfield  class recipe(models.model):     instructions = markupfield(default_markup_type='markdown') 

then render field in jinja2 template, this:

{% if recipe.instructions %}     {{ recipe.instructions }} {% else %}     no instructions have been added yet. {% endif %} 

rendering of markdowned text works flawless, placed string inside dom browser doesn't interpret html tags, can see here:

view in browser, note <p> tag.

view in dom inspector, note <p> tags.

i don't feel missed relevant in django-markupfield's docs, somehow need rid of string representation.

anyone of guys got idea? in advance.

thanks @doru's advices stumbled across jinja2 documentation , found autoescaping statement:

{% autoescape off %}{{ recipe.instructions }}{% endautoescape %} 

this 1 worked me.

it's possible make work globally setting autoescape option false.

{     'backend': 'django_jinja.backend.jinja2',     ...     'options': {         'autoescape': false,         ...     } }, 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -