Skip to content

Commit d9effde

Browse files
knaperekkmmbvnr
authored andcommitted
Preserve chosen "using" DB in ConcurrentTransitionMixin
1 parent 716e659 commit d9effde

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

django_fsm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def _do_update(self, base_qs, using, pk_val, values, update_fields, forced_updat
530530
# INSERT if UPDATE fails.
531531
# Thus, we need to make sure we only catch the case when the object *is* in the DB, but with changed state; and
532532
# mimic standard _do_update behavior otherwise. Django will pick it up and execute _do_insert.
533-
if not updated and base_qs.filter(pk=pk_val).exists():
533+
if not updated and base_qs.filter(pk=pk_val).using(using).exists():
534534
raise ConcurrentTransition("Cannot save object! The state has been changed since fetched from the database!")
535535

536536
return updated

0 commit comments

Comments
 (0)