Skip to content

Commit 3dc622e

Browse files
knaperekpfouque
authored andcommitted
Preserve chosen "using" DB in ConcurrentTransitionMixin
1 parent f45215f commit 3dc622e

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
@@ -503,7 +503,7 @@ def _do_update(self, base_qs, using, pk_val, values, update_fields, forced_updat
503503
# INSERT if UPDATE fails.
504504
# Thus, we need to make sure we only catch the case when the object *is* in the DB, but with changed state; and
505505
# mimic standard _do_update behavior otherwise. Django will pick it up and execute _do_insert.
506-
if not updated and base_qs.filter(pk=pk_val).exists():
506+
if not updated and base_qs.filter(pk=pk_val).using(using).exists():
507507
raise ConcurrentTransition("Cannot save object! The state has been changed since fetched from the database!")
508508

509509
return updated

0 commit comments

Comments
 (0)