Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheritance model doesn't update sort. #329

Open
portedison opened this issue Sep 5, 2022 · 2 comments
Open

Inheritance model doesn't update sort. #329

portedison opened this issue Sep 5, 2022 · 2 comments

Comments

@portedison
Copy link

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):
      ....
@portedison
Copy link
Author

Is this the idea of PolymorphicSortableAdminMixin-

class PolymorphicSortableAdminMixin(SortableAdminMixin):

@jrief
Copy link
Owner

jrief commented Sep 6, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants