How to judge OR and NOT three states in Anqi CMS template?
yesnoThe filter can OR and NOT three states.yesnoThere are 3 default values, namely 'yes', 'no', 'maybe'.You can also customize these three values to other values.
When the value is false, return no, when the value is true, return yes, when the value is nil, return maybe.
Usage method
yesnoHow to use the filter:
{{ obj|yesno }}
Example Demonstration
{{ 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" }}
Display result
yes
no
maybe
maybe
ja
nein
maybe