Opened 17 years ago
Closed 17 years ago
#5199 closed (fixed)
FormSet uses incorrect logic for is_bound
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Forms | Version: | newforms-admin |
Severity: | Keywords: | FormSet logic | |
Cc: | david@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The init logic of the FormSet is incorrect, and doesn't follow the logic of a Form:
http://code.djangoproject.com/browser/django/branches/newforms-admin/django/newforms/formsets.py#24
self.is_bound = data is not None and files is not None
vs.
http://code.djangoproject.com/browser/django/trunk/django/newforms/forms.py#L61
self.is_bound = data is not None or files is not None
The "and" in the FormSet code makes a FormSet that is passed data but no files set is_bound = False.
Attachments (1)
Change History (3)
by , 17 years ago
Attachment: | formset_logic.patch added |
---|
comment:1 by , 17 years ago
The reason why I ran into this is that calling FormSet.is_valid() will raise an error about self._is_valid not existing (due to it not getting set until the end of self.full_clean() which gets short-circuited by a check for self.is_bound).
comment:2 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch that switches logic from "and" to "or"