jrief/django-admin-sortable2

Inheritance model doesn't update sort.

portedison opened this issue · 2 comments

With inheritance, e.g. Writing, Event, etc all inheriting from Content. Creating Writing doesn't trigger (or implement) the admin mixin applied to the Content model. They add with the default value '0'. And subsequently can't be updated, as there are too many with the value of '0'. How should we trigger this to resort (similar to the management command) after save?

class Content(models.Model):
      sort_order = models.PositiveIntegerField(default=0, db_index=True)
      ...

class Writing(Content):
      ....

Is this the idea of PolymorphicSortableAdminMixin-

class PolymorphicSortableAdminMixin(SortableAdminMixin):

jrief commented

Could you please fork the project and create a polymorphic model where this problem occurs. For instance by separating Book from Magazin (a magazin doesn't have an author but a publisher). I then can look for a solution and use that as a starting point to implement a unit test.