From 4ad5ec0f11f0a7092be0b9a56a47f7d8123d5022 Mon Sep 17 00:00:00 2001 From: ldeluigi <44567586+ldeluigi@users.noreply.github.com> Date: Fri, 8 Nov 2024 10:59:30 +0100 Subject: [PATCH] Fix #402 --- adminsortable2/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adminsortable2/admin.py b/adminsortable2/admin.py index c3d58d7..c235665 100644 --- a/adminsortable2/admin.py +++ b/adminsortable2/admin.py @@ -487,7 +487,7 @@ def save_new(self, form, commit=True): obj = super().save_new(form, commit=False) order_field_value = getattr(obj, self.default_order_field, None) - if order_field_value is None or order_field_value >= 0: + if order_field_value is None or order_field_value < 0: max_order = self.get_max_order() setattr(obj, self.default_order_field, max_order + 1) if commit: