mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
Fixed #19545 -- Make sure media/is_multipart work with empty formsets
This commit is contained in:
committed by
Claude Paroz
parent
9b5f64cc6e
commit
3fc43c964e
@@ -333,7 +333,10 @@ class BaseFormSet(object):
|
||||
Returns True if the formset needs to be multipart, i.e. it
|
||||
has FileInput. Otherwise, False.
|
||||
"""
|
||||
return self.forms and self.forms[0].is_multipart()
|
||||
if self.forms:
|
||||
return self.forms[0].is_multipart()
|
||||
else:
|
||||
return self.empty_form.is_multipart()
|
||||
|
||||
@property
|
||||
def media(self):
|
||||
@@ -342,7 +345,7 @@ class BaseFormSet(object):
|
||||
if self.forms:
|
||||
return self.forms[0].media
|
||||
else:
|
||||
return Media()
|
||||
return self.empty_form.media
|
||||
|
||||
def as_table(self):
|
||||
"Returns this formset rendered as HTML <tr>s -- excluding the <table></table>."
|
||||
|
||||
Reference in New Issue
Block a user