N
N
neulwert2019-12-17 16:42:59
Django
neulwert, 2019-12-17 16:42:59

Why create loops and branches with the variable name in the condition?

The django documentation has this html code:

{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}

Here, the condition contains the name of the variable, if you remove the condition, the code still works, please tell me what is the meaning of such conditions, which are fulfilled anyway. I also saw something similar with a while loop.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-12-17
@neulwert

The point is not to load the DOM with empty tags.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question