I am wondering if we could use django filter as a variable where a python method formatting text can set the filter value which can be rendered by the template
The usual way filter works is like this
{{ html_text | safe }} or {{ plain_text | linebreaks }}
I want to set the values for filters ‘safe’/’linebreaks’ in a variable and render it like this
{{ text | filter_variable }}
Researched online, but couldn’t figure it out, any help would be appreciated.
I second what Chris Pratt said, but I’d do it like this:
that way it works for any filter.