I would like to know if is there any way to do a short if-else in the django template such as in php?
<?=$variable ? 'String for true' : 'String for false'?>
If variable value is true, display String for true
otherwise String for false
There is yesno template filter which maps values for true, false.
{{ variable|yesno:'String for true,String for false' }}
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