Opened 2 years ago

Closed 2 years ago

#29465 closed Bug (invalid)

Admin._changeform_view incorrectly initializes ModelForm instance

Reported by: Gert Steyn Owned by: nobody
Component: contrib.admin Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Gert Steyn)

In django.contrib.admin.options.ModelAdmin._changeform_view:

form = ModelForm(request.POST, request.FILES, instance=obj)

this line should be:

form = ModelForm(data=request.POST, files=request.FILES, instance=obj)

data and files are not positional arguments, this causes issues if a form with additional kwargs is used.

Change History (2)

comment:1 Changed 2 years ago by Gert Steyn

Description: modified (diff)

comment:2 Changed 2 years ago by Simon Charette

Resolution: invalid
Status: newclosed

Hello Gert,

From looking at the forms documentation both data and files seem to be documented as positional so I'm going to close this ticket as invalid.

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