Opened 11 years ago

Closed 11 years ago

#6938 closed (fixed)

[newforms-admin] Initial form data passed from request.GET isn't handled correctly by the admin

Reported by: Matthias Pronk <django@…> 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


The admin interface used to pass initial data from the URL to the forms, so calling for example:


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)

nfa_initial_get_parameters.diff (680 bytes) - added by Matthias Pronk <django@…> 11 years ago.

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by Matthias Pronk <django@…>

comment:1 Changed 11 years ago by Matthias Pronk <django@…>

Resolution: invalid
Status: newclosed

Instead of solving this in the Admin, it would be better to fix it in the ModelForm code, see #6939

comment:2 Changed 11 years ago by Brian Rosner

Resolution: invalid
Status: closedreopened

Reopening due to the note in #6314.

comment:3 Changed 11 years ago by Brian Rosner

Triage Stage: UnreviewedReady for checkin

comment:4 Changed 11 years ago by Brian Rosner

Resolution: fixed
Status: reopenedclosed

(In [7434]) newforms-admin: Fixed #6938 -- request.GET is now coerced into a dict before being passed as initial data in ModelAdmin.add_view. Thanks Matthias Pronk.

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