id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 11832 include tag with optional block argument (selective include feature) Marco Paolini nobody "Sometimes, for clarity, an included template contains code for different parts of the parent. This patch allows an extra {{{block}}} optional argument to the include tag. If specified, only that particular block of the included template will be included. an example: base.html: {{{ {% include ""table-include"" ""jscript"" %} {% include ""table-include"" ""header"" %} {% for row in rows %} {% include ""table-include"" ""rowdata"" %} {% endfor %}
}}} table-include.html: {{{ {% block jscript %} {% endblock %} {% block header %} heading {% endblock %} {% block rowdata %} {{row.data}} {% endblock %} }}} Without this patch you would need three different included tepmlates like: table-include-js.html, table-include-header.html and table-include-rowdata.html making the whole thing less maintainable if the block in arg is not found maybe we should raise a {{{TemplateSyntaxError}}} (or maybe not) patch is just a proof of concept. Tests included comments welcome " closed Template system 1.1 wontfix feature Unreviewed 1 0 0 0 0 0