python - How to read Jinja from a model in Django? -


i want store small django templates in database , include them in view. need call

<ul>     {% item in foo.items.all %}      <li>{{ item.snippit }}</li>     {% endfor %} </ul> 

where snippet string this product made {{ bar.percent }} &percnt; recycled materials

i need know how go rendering text jinja before sending client

for simple answer see https://stackoverflow.com/a/2462909/7976758

for more elaborate solution use https://github.com/jazzband/django-dbtemplates

django template loader database stored templates.

  1. it allows store templates in database.
  2. it provides template loader enables django load templates database.

Comments