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 takes the connection error ECONNREFU...
How to make tomcat support https access step: (1)...
1. Introduction In the past, if you wanted to emp...
First: Copy code The code is as follows: <input...
Preface The Windows system that can be activated ...
today select * from table name where to_days(time...
Method 1: Use lsof command We can use the lsof co...
Table of contents 1. Database bottleneck 2. Sub-l...
Preface Since the types of the same fields in the...
This article shares the specific code for impleme...
This article shares the download and installation...
Summary HTML: element plus v-cloak CSS: [v-cloak]...
border-radius:10px; /* All corners are rounded wi...
The first step is to prepare an icon making softwa...
Table of contents 1. What is a component? 2. Crea...