0

How many different block tags 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 %}

2 Answers 2

4

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.

1
  • Thanks! One more thing. I read the django book section on Templates from start to beginning. If I ask questions about it here I did either not find it and/or overlooked it. It is very complex to learn django and python and it is great to have this quick and great help. And I think these questions can be valuable for future students.
    – MacPython
    Jun 23, 2010 at 12:47
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.