﻿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
15722	Conditional Formset Rendering/Validation	Mark Lavin	nobody	"#14655 introduced formsets as iterables and defined `__len__` as the number of forms. However this causes a  side effect in that if there are no forms then bool returns `False`. Meaning if you have a condition in your template which looks for the formset in the context before rendering

{{{
{% if formset %}
{# formset rendering would go here... #}
{% endif %}
}}}

then if there are no forms this will not render. It also means that the management form will not be rendered. On POST if the formset is bound without the management form data it raises a `ValidationError` on `__init__`.

There are possible work-arounds:
    1.) Override `__nonzero___` on the formset to return `True`

    2.) Change conditional statements to look for the existence of the management form instead i.e. `{% if formset.management_form %}` 
"	Bug	closed	Forms	1.3	Normal	fixed		ironfroggy@… mmanfre@…	Accepted	1	0	0	0	0	0
