How to make a variable in Jijna2 default to "" if object is None instead of doing something like this?
{% if p %}
{{ p.User['first_name']}}
{% else %}
NONE
{%endif %}
So if object p isNone. I want to default the values of p (first_name and last_name) to "".
Basically:
nvl(p.User[first_name'], "")
Error receiving:
Error: jinja2.exceptions.UndefinedError
UndefinedError: 'None' has no attribute 'User'
pnever returnNone. Instead ofNonethe function should return a proxy object that has the same structure as a real object but it is loaded with the default values that you want.