django-nested-inline icon indicating copy to clipboard operation
django-nested-inline copied to clipboard

"object has no attribute 'inlines'" when having multiple inlines for a admin model form

Open andreyshipilov opened this issue 10 years ago • 4 comments
trafficstars

The error occurs at "nested_inline/admin.py in add_view" line 178 when trying to save an object.

As an example I have these lines:

inlines = (CaseStudyTextBlockInline, CaseStudyFullWidthImageInline, CaseStudyVideoInline,
               CaseStudyImageSliderInline)

And the error is "'CaseStudyTextBlockInline' object has no attribute 'inlines'".

Am I doing something wrong?

andreyshipilov avatar Oct 16 '15 12:10 andreyshipilov

Just add an empty inlines attributes in your 'classic' Inlines classes, should work fine then.

marcoooo avatar Mar 14 '16 10:03 marcoooo

Or just use a try/except.

bilind avatar May 04 '16 21:05 bilind

Same here! It was the @marcoooo a valid solution? Reading the docs, the last level "Inline" doesn't have any inlines attribute... It's weird because I've got two classes that inherit from NestedModel, one works and the other one don't...

mpvillafranca avatar Jul 22 '16 08:07 mpvillafranca

@marcoooo 's answer worked for me, but I am not sure if this should be the valid solution

zsoltbalint avatar May 27 '20 12:05 zsoltbalint