Fixed Django 2.1 error due to missing use_required_attribute=False for empty forms
This attribute is supported as of Django 1.10, so adding it without conditional Django version checks. Fixes #360
This commit is contained in:
@@ -153,6 +153,7 @@ class BasePolymorphicModelFormSet(BaseModelFormSet):
|
|||||||
# the minimum forms.
|
# the minimum forms.
|
||||||
if i >= self.initial_form_count() and i >= self.min_num:
|
if i >= self.initial_form_count() and i >= self.min_num:
|
||||||
defaults['empty_permitted'] = True
|
defaults['empty_permitted'] = True
|
||||||
|
defaults['use_required_attribute'] = False
|
||||||
defaults.update(kwargs)
|
defaults.update(kwargs)
|
||||||
|
|
||||||
# Need to find the model that will be displayed in this form.
|
# Need to find the model that will be displayed in this form.
|
||||||
@@ -248,6 +249,7 @@ class BasePolymorphicModelFormSet(BaseModelFormSet):
|
|||||||
auto_id=self.auto_id,
|
auto_id=self.auto_id,
|
||||||
prefix=self.add_prefix('__prefix__'),
|
prefix=self.add_prefix('__prefix__'),
|
||||||
empty_permitted=True,
|
empty_permitted=True,
|
||||||
|
use_required_attribute=False,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
self.add_fields(form, None)
|
self.add_fields(form, None)
|
||||||
|
|||||||
Reference in New Issue
Block a user