﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28585	Set `has_file_field` context attribute for admin change forms conditionally on Form.is_multipart()	Mark Rogaski	nobody	"In django.contrib.admin.options.ModelAdmin:

{{{
    def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):
        ...
        context.update({
            ...
            'has_file_field': True,  # FIXME - this should check if form or formsets have a FileField,
            ...
}}}

This attribute is used to determine whether a `multipart/form-data` is used for the form content type instead of `application/x-www-form-urlencoded`.

I'd like to implement this behavior as it appears to have been intended (and I have a situation where multipart forms should only be used if necessary for file uploads).  However, it's likely that some applications might be adversely impacted if the behavior changes.   Perhaps adding an `AVOID_MULTIPART_ADMIN_FORMS` setting or an `avoid_multipart ModelAdmin` attribute that defaults to the current behavior is appropriate (better suggestions for the naming are welcome).

In any case, I'd like to be able to have non-multipart forms returned when multipart isn't needed without having to subclass ModelAdmin.

I am also happy to submit a PR for this based upon the preferred approach to backward compatibility."	Cleanup/optimization	closed	contrib.admin	1.11	Normal	fixed			Accepted	1	0	0	0	0	0
