﻿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
30243	Reduce structural dependency in contrib.admin 'has_file_field' checks	btknu	btknu	"This ticket is about a very small cleanup. It's possible that a Trac ticket isn't necessary for this, I decided to make one to stay on the safe side.

The PR https://github.com/django/django/pull/9298 for ticket https://code.djangoproject.com/ticket/28585 adds code:

{{{
            'has_file_field': context['adminform'].form.is_multipart() or any(
                admin_formset.formset.form().is_multipart()
                for admin_formset in context['inline_admin_formsets']
            ),
}}}

This snippet invokes `is_multipart()` on formset's `form()` object.
But the formset (specifically: `BaseFormSet`) already provides an `is_multipart()` method.

It feels cleaner to rely on a single place to calculate `is_multipart` for a formset.
This way if `is_multipart` logic gets more complex, we only need to update it in one place and there's less risk of bugs.

I suggest replacing:

{{{
admin_formset.formset.form().is_multipart()
}}}

with:

{{{
admin_formset.formset.is_multipart()
}}}"	Cleanup/optimization	closed	contrib.admin	dev	Normal	fixed			Ready for checkin	1	0	0	0	1	0
