Opened 14 years ago
Closed 14 years ago
#15256 closed (invalid)
FormSet does not respect initial values after binding — at Version 2
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 )
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)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Description: | modified (diff) |
---|---|
Resolution: | → invalid |
Status: | new → closed |
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.
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 :\