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()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30243>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/30243#comment:1>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"7c3a8b9db2ccfbb247732ce6726ab8dc11eff34d" 7c3a8b9]:
{{{
#!CommitTicketReference repository=""
revision="7c3a8b9db2ccfbb247732ce6726ab8dc11eff34d"
Fixed #30243 -- Simplified ModelAdmin.render_change_form()'s
has_file_field.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30243#comment:2>