Skip to content

Commit

Permalink
Merge pull request #373 from intsynko/master
Browse files Browse the repository at this point in the history
fix index on parallel queries
  • Loading branch information
jrief authored Nov 25, 2024
2 parents 39f26bc + 1091815 commit 1e29b2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adminsortable2/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def _move_item(self, startorder, endorder, extra_model_filters):

with transaction.atomic():
try:
obj = model.objects.get(**obj_filters)
obj = model.objects.select_for_update().get(**obj_filters)
except model.MultipleObjectsReturned:

# noinspection PyProtectedMember
Expand All @@ -318,7 +318,7 @@ def _move_item(self, startorder, endorder, extra_model_filters):
"to adjust this inconsistency."
)

move_qs = model.objects.filter(**move_filter).order_by(order_by)
move_qs = model.objects.select_for_update().filter(**move_filter).order_by(order_by)
move_objs = list(move_qs)
for instance in move_objs:
setattr(
Expand Down

0 comments on commit 1e29b2b

Please sign in to comment.