Opened 16 years ago

Closed 16 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

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)

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

Download all attachments as: .zip

Change History (5)

by Matthias Pronk <django@…>, 16 years ago

comment:1 by Matthias Pronk <django@…>, 16 years ago

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 by Brian Rosner, 16 years ago

Resolution: invalid
Status: closedreopened

Reopening due to the note in #6314.

comment:3 by Brian Rosner, 16 years ago

Triage Stage: UnreviewedReady for checkin

comment:4 by Brian Rosner, 16 years ago

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