endblock-label¶
Added in 1.1.0 · Related issues · View source
Fix is always available.
What it does¶
Checks for {% endblock %} tags that repeat the block's name on a single-line block, or omit
it on a block spanning several lines.
Why is this bad?¶
On one line, the opening tag is in view and the label is noise. Over several lines, the opening tag may be out of view, and the label tells which block ends.
Also applies to {% endpartialdef %}, and to the custom-blocks listed in
lint.endblock-label.custom-blocks. Django rejects an {% endblock %} label naming another
block, but accepts any label on a custom block, so for those the rule also fixes a label that
does not match.
Example¶
Use instead:
Options¶
References¶
- Django coding style: template style
- Django documentation: template inheritance
- Django documentation: template partials