In the web development process of Django, when writing HTML, a list variable with the same name is passed in from the backend, but the content format is different and needs to be judged separately. I have read many articles and tried several methods, but the format does not seem to be right ( I have never systematically learned the front-end, and I basically just copy the gourd)
Later I found the if usage of html under the django framework
The form is roughly as follows
<div class=if/else> {% if formname == 'Callrecords'%} Callrecords {% elif formname == 'Riderecords'%} Riderecords {% elif formname == 'Clubinfo'%} Clubinfo {% elif formname == 'Clubmemb'%} Clubmemb {% elif formname == 'Personinfo'%} Personinfo {% endif %} </div>
This syntax is provided by Django. It is used in native HTML code writing but is useless. The above code box uses HTML format, but you can also see that the content in the middle of the <div> tag cannot be marked by the HTML language, indicating that It is not a built-in syntax of html.
But at least my django project has no problem using it!
SummarizeThe above is the if judgment usage in HTML introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time!