Or with non-three states

How to judge or differ from three states in Anqi CMS template?

yesnoThe filter can be or with non-three states.yesnoThere are 3 default values, namely "yes", "no", and "maybe". You can also customize these three values ​​as other values.
When the value is false, no is returned, when the value is true, yes is returned, and when the value is nil, that is, null, return maybe.

How to use

yesnoHow to use filters:

{{ obj|yesno }}

Sample Demo

{{ simple.bool_true|yesno }}
{{ simple.bool_false|yesno }}
{{ simple.nil|yesno }}
{{ simple.nothing|yesno }}
{{ simple.bool_true|yesno:"ja,nein,vielleicht" }}
{{ simple.bool_false|yesno:"ja,nein,vielleicht" }}
{{ simple.nothing|yesno:"ja,nein" }}

Show results

yes
no
 maybe
 maybe
ja
nein
 maybe