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:
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
Post a Comment