theatlantic / django-nested-admin

Django admin classes that allow for nested inlines
http://django-nested-admin.readthedocs.org/
Other
690 stars 97 forks source link

Handle subclasses of PolymorphicModel being abstract #228

Open trumpet2012 opened 1 year ago

trumpet2012 commented 1 year ago

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.