Opened 8 years ago

Closed 8 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: UI/UX:


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@…> 8 years ago.

Download all attachments as: .zip

Change History (5)

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

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

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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

comment:2 Changed 8 years ago by brosner

  • Resolution invalid deleted
  • Status changed from closed to reopened

Reopening due to the note in #6314.

comment:3 Changed 8 years ago by brosner

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:4 Changed 8 years ago by brosner

  • Resolution set to fixed
  • Status changed from reopened to closed

(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