How do I persuade Jinja2 to not print \"None\" when the value is None?
\"None\"
None
I have a number of entries in a dictionary and I would like to outpu
A custom filter can solve the problem. Declare it like this:
def filter_suppress_none(val): if not val is None: return val else: return ''
Install it like this:
templating_environment.filters['sn'] = filter_suppress_none
Use it like this:
{{value|sn}}