#1 by tyhayeswbs
I was hoping to use the `{{ x|default("default value") }}` filter on a template that gets reused heavily (i.e. it is a base template that all my other templates inherit from) in my experiment to set a default value. The intention is that I only have to include this variable in `vars_for_template()` on pages that should deviate from the default behaviour.
However when I try to use this filter with a variable that is otherwise undefined, I get an `otree.templating.errors.UndefinedVariable: Cannot resolve the variable` exception thrown.
Does the default filter only work for fields that exist but may be null? If so, that should probably be mentioned in the documentation. If it's intended to work in my use case (i.e. when the variable is not otherwise defined), I think there's a bug.
(P.S. when looking at the sourcecode for that filter, it appears that it would replace any falsey value even if the value is intentionally set to False or 0, which should probably also be documented, or better, fixed so that it overrides nullish rather than falsey values ).