Extends,block and include in the Django template language

Source: Internet
Author: User
Extends and block together.

They are used for inheritance of master and child versions

Use {% block xxx%} in the master HTML for some parts that need to be replaced ... {% Endblock%},

In the child HTML, the first line needs to write the master to inherit, {% extends ' master relative path '%} to introduce the master.

Include

The introduction of the Include user public template is a good way to introduce a public template when a certain HTML language is required in many pages (not all).

In the current HTML where you need to introduce a public template, use the {% include ' relative path '%} of the public template to introduce.

Extends,block and include in the Django template language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.