1👍
✅
As Django’s template engine can easily be used anywhere in your code you should be able to do something like this:
from django.template import Context, Template
rendered = Template("{% load your_tag_library %}",
object.textfield).render(Context())
Rather than rendering the template from a file it renders it from a string like:
"{% load your_tag_library %}lorem ipsum dolor {% mytag %}"
The code can for instance be used in your view or as a method on your model. Note that the Context
is empty, you might as well pass a dict with template variables to it.
Furthermore, to handle it directly in the template you could write a custom templatetag which does something similiar, basically a templatetag that parses strings for templatetags.
Source:stackexchange.com