Home »
Python »
Django MCQs
Which Django template tag is used to return the first not empty variable?
21. Which Django template tag is used to return the first not empty variable?
- empty
- firstempty
- firstemptyvar
- firstof
Answer: D) firstof
Explanation:
The firstof is a Django template tag that is used to return the first not empty variable. Consider the below syntax –
{% firstof variable_name_1 variable_name_2 variable_name_3 etc. %}