In the process of Django web development, when writing HTML, a list variable with the same name is passed from the backend, but the content format is different and needs to be judged separately. I have consulted many articles and tried several methods, but the format seems to be wrong (I have not systematically studied the front end, and basically just copied it) The format 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 and is used in native HTML code writing but is useless. The code box above uses the HTML format, but you can also see that the content between the <div> tags cannot be marked by the HTML language, indicating that it is not a built-in HTML syntax. Summarize The above is the usage of if judgment in HTML introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time! |
<<: How to check if data exists before inserting in mysql
>>: Detailed explanation of the principle of Vue monitoring data
This article shares the specific code of JavaScri...
What is Let’s first look at the concept of Docker...
1. Select Edit → Virtual Network Editor in the me...
2.1 Semanticization makes your web pages better u...
1. Download the installation package Download add...
A few days ago, I discovered that my website was ...
Demand background The project is made using Vue, ...
1. Grid layout (grid): It divides the web page in...
Preface This article introduces the fifth questio...
Before talking about OO, design patterns, and the ...
Table of contents 1. First, configure the main.js...
1. Built-in functions 1. Mathematical functions r...
VMware Workstation is a powerful desktop virtual ...
1 MySQL autocommit settings MySQL automatically c...
Table of contents 1. Related binlog configuration...