﻿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
5835	New CheckboxInput method breaks edit_inline validation	Lllama	nobody	"In [6613] a new method was added to the CheckboxInput widget (in django/newforms/widgets.py)

{{{
    def value_from_datadict(self, data, files, name):
        if name not in data:
            # A missing value means False because HTML form submission does not
            # send results for unselected checkboxes.
            return False
        return super(CheckboxInput, self).value_from_datadict(data, files, name)
}}}

With this method any blank edit_inline objects in newforms-admin will generate errors, with each field (other than the delete checkbox) saying that it is required. (Changing the return value from 'False' to 'None' will correct the error.) Using this I tracked down the calls to value_from_datadict to django/newforms/forms.py. The is_empty() method:
{{{
    def is_empty(self, exceptions=None):
        """"""
        Returns True if this form has been bound and all fields that aren't
        listed in exceptions are empty.
        """"""
        # TODO: This could probably use some optimization
        exceptions = exceptions or []
        for name, field in self.fields.items():
            if name in exceptions:
                continue
            # value_from_datadict() gets the data from the dictionary.
            # Each widget type knows how to retrieve its own data, because some
            # widgets split data over several HTML fields.
            value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name))
            # HACK: ['', ''] and [None, None] deal with SplitDateTimeWidget. This should be more robust.
            if value not in (None, '', ['', ''], [None, None]):
                return False
        return True
}}}

contains the HACK line. Adding 'False' to the tuple in the 'if' statement again causes the error to disappear.

I'm guessing that this will only appear in newforms-admin as that's where we get the checkboxes for deleting."		closed	Forms	newforms-admin		duplicate			Unreviewed	0	0	0	0	0	0
