#15256: FormSet does not respect initial values after binding
--------------------------------------+-------------------------------------
Reporter: mnbayazit | Owner: nobody
Status: closed | Milestone:
Component: Forms | Version: SVN
Resolution: invalid | Keywords: formset
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 |
--------------------------------------+-------------------------------------
Changes (by russellm):
* status: new => closed
* resolution: => invalid
Old 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():
> 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.
New 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():
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.
--
Comment:
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.
--
Ticket URL: <http://code.djangoproject.com/ticket/15256#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.