Opened 17 years ago

Closed 17 years ago

#5173 closed (worksforme)

Formsets - Empty form fields display validation errors

Reported by: Simon Litchfield <simon@…> 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)

formsets-empty-forms-5897.diff (1.2 KB ) - added by Simon Litchfield <simon@…> 17 years ago.
Quick hack to fix the problem, against rev 5897

Download all attachments as: .zip

Change History (4)

by Simon Litchfield <simon@…>, 17 years ago

Quick hack to fix the problem, against rev 5897

comment:1 by Simon Litchfield <simon@…>, 17 years ago

Has patch: set
Needs tests: set
Owner: changed from Adrian Holovaty to anonymous
Status: newassigned
Triage Stage: UnreviewedDesign decision needed

Also fixes which on surface seems to be a small typo in _get_change_forms().

comment:2 by anonymous, 17 years ago

Owner: changed from anonymous to Adrian Holovaty
Status: assignednew

comment:3 by jkocherhans, 17 years ago

Resolution: worksforme
Status: newclosed

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

Note: See TracTickets for help on using tickets.
Back to Top