On 22/10/2013 4:56am, fchow wrote:
> My question is about returning HTML markup in a model method vs. a
> custom template filter.
Personally, I prefer the custom template filter due to a nicer
separation of model/display concerns.
That said, I recently discovered Django's mark_safe()
from django.utils.safestring import mark_safe
def known_good_html(value):
...
return mark_safe(value)
The returned object type is recognised by the template rendering engine
as not needing further escaping.
hth
Mike