I created a regular baseinlineformset and added the Oformse, polymorphic_inlineformset, to it.
I "model = defaults['instance'].get_real_instance_class() # allow proxy models
AttributeError: 'NoneType' object has no attribute 'get_real_instance_class' " for the form.nested in the is_valid()
class MyBaseFormset(BaseInlineFormSet):
def add_fields(self, form, index):
super(BaseScenarioFormset, self).add_fields(form, index)
form.nested=Oformset(instance=form.instance,
data=form.data if form.is_bound else None,
files=form.files if form.is_bound else None,
prefix='modelobject-%s-%s' % (form.prefix,
Oformset.get_default_prefix())
)
def is_valid(self):
result =super(BaseScenarioFormset, self).is_valid()
if self.is_bound:
for form in self.forms:
result=result and form.nested.is_valid()
return result
def save(self, commit=True):
result=super(BaseScenarioFormset, self).save(commit=commit)
for form in self:
form.nested.save(commit=commit)
return result
Having the same error with django-cms.
When you edit a polymorphic-inline-model which gets deleted in the background and you safe it, the above error occurs.
Thank you creating this django package.
I am trying to create a nested inline formset with the innermost being the polymorphic inline formset
this my polymorphic inline formset
I created a regular baseinlineformset and added the Oformse, polymorphic_inlineformset, to it.
I "model = defaults['instance'].get_real_instance_class() # allow proxy models AttributeError: 'NoneType' object has no attribute 'get_real_instance_class' " for the form.nested in the is_valid()
formset that will hold the polyinlineformset