Usage of if judgment in HTML

Usage of if judgment in HTML

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)
Later I found the usage of html if in Django framework

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.
But at least my Django project has no problem using it!

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

Recommend

JavaScript to achieve simple drag effect

This article shares the specific code of JavaScri...

Detailed explanation of Docker container data volumes

What is Let’s first look at the concept of Docker...

How to set a fixed IP address for a VMware virtual machine (graphic tutorial)

1. Select Edit → Virtual Network Editor in the me...

Front-end development must learn to understand HTML tags every day (1)

2.1 Semanticization makes your web pages better u...

Installation process of zabbix-agent on Kylin V10

1. Download the installation package Download add...

display:grid in CSS3, an introduction to grid layout

1. Grid layout (grid): It divides the web page in...

How to bypass unknown field names in MySQL

Preface This article introduces the fifth questio...

Copy and paste is the enemy of packaging

Before talking about OO, design patterns, and the ...

Example of adding multi-language function to Vue background management

Table of contents 1. First, configure the main.js...

MySQL: mysql functions

1. Built-in functions 1. Mathematical functions r...

VMware Workstation Pro 16 License Key with Usage Tutorial

VMware Workstation is a powerful desktop virtual ...

Detailed explanation of MySQL and Spring's autocommit

1 MySQL autocommit settings MySQL automatically c...

Solution to Mysql binlog log file being too large

Table of contents 1. Related binlog configuration...