Django

Code

Ticket #6938 (closed: fixed)

Opened 3 months ago

Last modified 3 months ago

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

Reported by: Matthias Pronk <django@masida.nl> Assigned to: nobody
Milestone: Component: Admin interface
Version: newforms-admin Keywords: nfa, newforms, admin
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

nfa_initial_get_parameters.diff (0.7 kB) - added by Matthias Pronk <django@masida.nl> on 04/01/08 12:20:33.

Change History

04/01/08 12:20:33 changed by Matthias Pronk <django@masida.nl>

  • attachment nfa_initial_get_parameters.diff added.

04/01/08 14:23:10 changed by Matthias Pronk <django@masida.nl>

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to invalid.
  • needs_tests changed.
  • needs_docs changed.

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

04/01/08 21:20:39 changed by brosner

  • status changed from closed to reopened.
  • resolution deleted.

Reopening due to the note in #6314.

04/01/08 21:20:50 changed by brosner

  • stage changed from Unreviewed to Ready for checkin.

04/16/08 14:48:15 changed by brosner

  • status changed from reopened to closed.
  • resolution set to fixed.

(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.


Add/Change #6938 ([newforms-admin] Initial form data passed from request.GET isn't handled correctly by the admin)




Change Properties
Action