﻿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
30671	Conditional for Template Block Content.	Novomotus	nobody	"When extending templates, it would be convenient to allow conditionals for determining whether or not a block has any data being passed.

Example:


{{{
base.html

<h1>{% block title %}{% endblock title %}</h1>
<h2>{% block subtitle %}{% endblock subtitle %}</h1>
}}}

When extending via another template, there may not always be both title and subtitle elements required for rendering:


{{{
article.html

{% extends '/templates/base.html' %}

<article class=""article"">
    {% block title %}{{ article.title }}{% endblock title %}
    {% block subtitle %}{{ article.subtitle }}{% endblock subtitle %}
    <p class=""article-body"">{{article.body }}</p>
</article>
}}}

Note: the second examples assumes a context object 'article' with properties 'title', 'subtitle', and 'body'.

**Issue Case**

In the above example, consider that an 'article' context object may have a ''title'' but no ''subtitle''.

There would be an empty <h2></h2> element rendered as the ""subtitle"" propery is wrapped in those html tags inside the ""base.html"" parent template.

**Requested Functionality**

Below is a syntactically-fictitious example of the proposed functionality:

{{{
base.html
{% if block|subtitle%}
<h1>{% block title %}{% endblock title %}</h1>
{% endblock subtitle %}
}}}

Where the 
{{{
{% if block|subtitle %}
}}}
statement would check for the existence of data of a block named ""subtitle""




"	New feature	closed	Template system	dev	Normal	wontfix	block, conditional, extends		Unreviewed	0	0	0	0	0	0
