Opened 14 years ago

Closed 14 years ago

#15256 closed (invalid)

FormSet does not respect initial values after binding

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 (last modified by Russell Keith-Magee)

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():
            defaults['data'] = self.data
            defaults['files'] = self.files

And completely remove this chunk from _get_empty_form

        if self.is_bound:
            defaults['data'] = self.data
            defaults['files'] = 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 (2)

in reply to:  description comment:1 by mnbayazit, 14 years ago

Nevermind... I don't my proposed fix works that well. But this is still a bug and I don't know how to get around it :\

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

Description: modified (diff)
Resolution: invalid
Status: newclosed

When providing a bug report, you should spend less time tell us how to fix the problem, and more time explaining the problem itself. If you're going to provide a code sample, make it a code sample that demonstrates the problem.

I can't work out how to reproduce the problem from the instructions provided; closing invalid. Feel free to reopen if you want to provide a reproducible test case.

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