Opened 14 years ago
Closed 14 years ago
#17677 closed Bug (fixed)
WizardView.get_form destroys 'instance' and 'queryset' from get_form_kwargs
| Reported by: | Gary Reynolds | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.formtools | Version: | 1.4-alpha-1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | yes |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | yes | UI/UX: | no |
Description
In the case where the wizard author might like to populate the form with an existing model instance or formset from a queryset based through get_form_kwargs it get's destroyed by a call to kwargs.update({'instance': self.get_form_instance(step)}) or kwargs.update({'queryset': self.get_form_instance(step)}).
While I can appreciate that there is already a way to populate this value by overloading the get_form_instance method, I don't think that we should be destructive of another way to achieve it. Additionally I find it less confusing if I can define all kwargs to be passed to my form/formset init method in one place (ie. in get_form_kwargs) rather than splitting this logic into two places.
I've attached a patch against r17511 which includes a test case.
Attachments (2)
Change History (4)
by , 14 years ago
| Attachment: | 17677.diff added |
|---|
comment:1 by , 14 years ago
| Needs documentation: | set |
|---|---|
| Patch needs improvement: | set |
| Triage Stage: | Unreviewed → Accepted |
by , 14 years ago
| Attachment: | 17677-2.diff added |
|---|
Updated patch (some test changes)