In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the knowledge of "introduction to the function of Django framework template". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Definition: in the Django framework, templates are tools that help developers quickly generate pages that are presented to users
The design of the template realizes the decoupling of VT in our MVT. VT has the relationship of NVR M, a V can call any T, and a T can be used by any V.
Template processing is divided into two processes.
① loading
② rendering
The template has two main parts.
① HTML static code
Code snippets dynamically inserted by ② (digging, filling)
In addition to the basic static filling, the dynamic code snippets in the template can also achieve some basic operations, transformations and logic.
Variables in the template: data passed from the view to the template, following the rules for identifiers
Syntax {{var}}
Labels in templat
Syntax {tag}
Action
Load externally incoming variables
Create text in the output
Control loop or logic
{% if expression%} statement {% endif%} {% if expression%} statement {% else%} statement {% endif%} {% if expression%} statement {% elif expression%} statement {% endif%} {% for variable in list%} statement 1 {% empty%} statement 2 {% endfor%}
There are two kinds of template language annotations:
1 single-line comment: {# commented out #}
2 multiline comment
{% comment%}
What is annotated
{% endcomment%}
This is the end of the introduction to the function of Django Framework template. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.