Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#15349 closed (fixed)

Bound FormSet produces bound empty_form

Reported by: hidde-jan Owned by: nobody
Component: Forms Version: master
Severity: Keywords: formset, is_bound, empty_form
Cc: carl.j.meyer@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The current implementation of BaseFormSet provides a method _get_empty_form. When a formset is bound, it supplies the data and files it received to the formclass. This results in the formset's empty_form being bound. This can lead to unexpected behaviour, especially when subclassing forms.Form.

The supplied patch has the fix and a test that checks wether the empty_form of a bound formset is still unbound.

Since the empty_form property was added for use as a template, there should be no difference, whatsoever, between the empty_form of a bound and an unbound formset.

Attachments (1)

unbound_empty_forms.diff (2.8 KB) - added by hidde-jan 3 years ago.

Download all attachments as: .zip

Change History (5)

Changed 3 years ago by hidde-jan

comment:1 Changed 3 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from 1.2 to SVN

comment:2 Changed 3 years ago by russellm

  • Has patch set
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:3 Changed 3 years ago by lukeplant

  • Resolution set to fixed
  • Status changed from new to closed

In [15614]:

Fixed #15349 - Bound FormSet produces bound empty_form

Thanks to hidde-jan for the report and patch.

comment:4 Changed 3 years ago by lukeplant

In [15615]:

[1.2.X] Fixed #15349 - Bound FormSet produces bound empty_form

Thanks to hidde-jan for the report and patch.

Backport of [15614] from trunk.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.