开发者

Django Template block tag

开发者 https://www.devze.com 2023-01-04 06:35 出处:网络
How many different block tag开发者_高级运维s like these exist? {% block %} In other words if I have a parent template and child templates with multiple block tags. How does Django know where to ins

How many different block tag开发者_高级运维s like these exist?

{% block %}

In other words if I have a parent template and child templates with multiple block tags. How does Django know where to insert if not by different block tag names?

Or can I customize like:

{% block_mytag_1 %}


Neither of these will work.

The documentation clearly explains this - you need to give each block in your parent template a different name:

{% block maincontent %}

This will be filled by whatever block in your child template has the same name.


You need this template documentation, particularly the part on Template Inheritance.

0

精彩评论

暂无评论...
验证码 换一张
取 消