Opened 17 years ago
Closed 17 years ago
#5173 closed (worksforme)
Formsets - Empty form fields display validation errors
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Forms | Version: | newforms-admin |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The formsets tests seem fine. However, when you actually display the fields, it causes them to bind, clean, and throw validation errors even though the forms are empty.
Forms who are part of a formset, should know to check is_empty (or similar) before binding and cleaning their fields.
Attachments (1)
Change History (4)
by , 17 years ago
Attachment: | formsets-empty-forms-5897.diff added |
---|
comment:1 by , 17 years ago
Has patch: | set |
---|---|
Needs tests: | set |
Owner: | changed from | to
Status: | new → assigned |
Triage Stage: | Unreviewed → Design decision needed |
Also fixes which on surface seems to be a small typo in _get_change_forms().
comment:2 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:3 by , 17 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Can you give some more details on what you are doing here? The empty add forms are reset when you call full_clean on the FormSet. I'm not able to reproduce this. The code from the view that produces this problem would probably be sufficient. Your solution may be better, but I haven't though it through yet. Either way seems really hackish. I'm closing this for now, but please reopen it if you post an example that triggers this.
Here's a link to the reset code:
http://code.djangoproject.com/browser/django/branches/newforms-admin/django/newforms/formsets.py#L122
Quick hack to fix the problem, against rev 5897