-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix sparse indexes when deleting #16
base: main
Are you sure you want to change the base?
Conversation
ddb8efc
to
a007311
Compare
a007311
to
b848354
Compare
@receiver(post_delete) | ||
def reorder_group(sender, instance, **kwargs): | ||
from drf_kit.models import OrderedModelMixin # pylint: disable=import-outside-toplevel | ||
|
||
if not issubclass(sender, OrderedModelMixin): | ||
return | ||
|
||
if previous := instance.previous(): | ||
# trigger the reordering | ||
previous.save() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can register signals for all instances of this model instead of registering to all, and them filtering.
version = "1.9.0" | ||
version = "1.10.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be 1.10.1
@@ -458,3 +458,37 @@ def test_create_before_range(self): | |||
self.assertOrder(placement_2, 2) | |||
self.assertOrder(placement_3, 3) | |||
self.assertOrder(placement_4, 0) | |||
|
|||
def test_delete_within_range(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use factories now.
No description provided.