How to judge OR and NOT three states in Anqi CMS template?
yesno
The filter can be OR and NOT three states.yesno
There are 3 default values, namely 'yes', 'no', and '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 Instructions
yesno
How to use the filter:
{{ obj|yesno }}
Here is an 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 results
yes
no
maybe
maybe
ja
nein
maybe