Opened 15 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
Pull Requests:How to create a pull request

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:

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To improve the patch as described in the pull request review comments or on this ticket, then uncheck "Patch needs improvement".
  • If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (11)

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

Attachment: 01-formset-refactoring.diff added

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

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

comment:1 by Petr Marhoun <petr.marhoun@…>, 15 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