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

Handle subclasses of PolymorphicModel being abstract

Open trumpet2012 opened this issue 3 years ago • 0 comments

When there was an abstract model in between a concrete subclass and it's PolymorphicModel class, the admin would not allow the child model to be moved because it was not in the allowed "childModels" being passed to the frontend.

For example the following would break:

graph TD;
  A[PolymorphicModel];
  A --> B[AbstractBase];
  B --> C[ChildOfAbstract];
  B --> D[ChildOfAbstract2];
  A --> E[DirectPolymorphicChild];

Before, the only valid child models passed to the frontend would be DirectPolymorphicChild and AbstractBase. This meant that ChildOfAbstract and ChildOfAbstract2 could be added to the admin, but were blocked from being moved around.

Added a test app to verify this change and show that now having an abstract class doesn't break the admin.

trumpet2012 avatar Sep 27 '22 20:09 trumpet2012