I was getting a VariableDoesNotExist error with the following snippet when obj1.page is None.
{{ obj1.val1|default:obj1.page.val2 }}
Normally Django templates don't care about attribute accesses on None values.
Django only cares about attribute lookups on None values inside the default template filter. I got around it using:
{% with obj1.page.val2 as val2 %}
{{ obj1.val1|default:val2 }}
{% endwith %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With