Opened 14 years ago

Last modified 14 years ago

#15256 closed

FormSet does not respect initial values after binding — at Initial Version

Reported by: mnbayazit Owned by: nobody
Component: Forms Version: dev
Severity: Keywords: formset
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

After the form is posted, if an empty form is generated, it will be completely empty rather than having the initial values specified on the form. I believe we can fix this by modifying _construct_form like so:

if self.is_bound and i < self.initial_form_count():

defaultsdata = self.data
defaultsfiles = self.files

And completely remove this chunk from _get_empty_form

if self.is_bound:

defaultsdata = self.data
defaultsfiles = self.files

I don't know why an empty form should behave any differently after the formset has been bound... it only seems to be causing problems.

Change History (0)

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