Opened 14 years ago

Last modified 14 years ago

#13878 new New feature

Formset validation refactoring and valid_forms property of fieldsets

Reported by: Petr Marhoun <petr.marhoun@…> Owned by: nobody
Component: Forms Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

This series of patch solves two problems:

  • Formsets validation is spread in four different methods so it is very difficult to comprehend the code and to solve possible problems.
  • There is no method which gives valid forms in all situation - especially, valid formset can contain invalid form if this form should be deleted. So this ticket adds new property valid_forms which returns all valid (and filled) forms, possible ordered.

There is wiki page and discussion in django-developers:

Attachments (6)

01-formset-refactoring.diff (8.9 KB ) - added by Petr Marhoun <petr.marhoun@…> 14 years ago.
02-formset-refactoring-cleaned-data-tests.diff (1.9 KB ) - added by Petr Marhoun <petr.marhoun@…> 14 years ago.
03-formset-refactoring-valid-forms-tests.diff (4.1 KB ) - added by Petr Marhoun <petr.marhoun@…> 14 years ago.
01-formset-refactoring.2.diff (8.9 KB ) - added by Petr Marhoun <petr.marhoun@…> 14 years ago.
02-formset-refactoring-cleaned-data-tests.2.diff (2.0 KB ) - added by Petr Marhoun <petr.marhoun@…> 14 years ago.
03-formset-refactoring-valid-forms-tests.2.diff (4.2 KB ) - added by Petr Marhoun <petr.marhoun@…> 14 years ago.

Download all attachments as: .zip

Change History (11)

by Petr Marhoun <petr.marhoun@…>, 14 years ago

Attachment: 01-formset-refactoring.diff added

by Petr Marhoun <petr.marhoun@…>, 14 years ago

by Petr Marhoun <petr.marhoun@…>, 14 years ago

comment:1 by Petr Marhoun <petr.marhoun@…>, 14 years ago

The first patch (01-formset-refactoring.diff) contains changes of code. The second patch (02-formset-refactoring-cleaned-data-tests.diff) shows that cleaned_data as attribute of formsets or forms in formsets are problematic (this patch could be applied to trunk to expose the situation). The third patch (03-formset-refactoring-valid-forms-tests.diff) contains tests for new property valid_forms.

by Petr Marhoun <petr.marhoun@…>, 14 years ago

by Petr Marhoun <petr.marhoun@…>, 14 years ago

by Petr Marhoun <petr.marhoun@…>, 14 years ago

comment:2 by Russell Keith-Magee, 14 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Marking accepted on the basis of the discussion on django-dev -- on principle, this sounds like a reasonable idea, but it needs a *very* detailed review. Widespread changes of this nature make me *very* nervous about backwards compatibility issues. The test coverage you have provided is a very good start, but I don't have complete confidence that the existing test suite covers all possible backwards compatibility issues.

Speaking of which -- the tests need to be updated to unittests; the patches don't currently apply cleanly.

comment:3 by Graham King, 14 years ago

Severity: Normal
Type: New feature

comment:4 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

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