Opened 18 years ago
Closed 18 years ago
#6938 closed (fixed)
[newforms-admin] Initial form data passed from request.GET isn't handled correctly by the admin
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | contrib.admin | Version: | newforms-admin |
| Severity: | Keywords: | nfa, newforms, admin | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The admin interface used to pass initial data from the URL to the forms, so calling for example:
/admin/auth/user/add/?username=foo
Would result in the "username" field to be prefilled with "foo".
This is broken in recent newforms-admin because the MultiValueDict (QueryDict) is used to extend an ordinary dict in django.newforms.forms.
The way to resolve this problem is to "flatten" the MultiValueDict to an ordinary dictionary, before passing it to the ModelForm.
Thanks to brosner on #django for the help! (basically fixing it ;)
Attachments (1)
Change History (5)
by , 18 years ago
| Attachment: | nfa_initial_get_parameters.diff added |
|---|
comment:1 by , 18 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
comment:2 by , 18 years ago
| Resolution: | invalid |
|---|---|
| Status: | closed → reopened |
Reopening due to the note in #6314.
comment:3 by , 18 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
comment:4 by , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Instead of solving this in the Admin, it would be better to fix it in the ModelForm code, see #6939