Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Preserve chosen "using" DB in ConcurrentTransitionMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
knaperek authored and kmmbvnr committed Jan 19, 2023
1 parent 716e659 commit d9effde
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion django_fsm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def _do_update(self, base_qs, using, pk_val, values, update_fields, forced_updat
# INSERT if UPDATE fails.
# Thus, we need to make sure we only catch the case when the object *is* in the DB, but with changed state; and
# mimic standard _do_update behavior otherwise. Django will pick it up and execute _do_insert.
if not updated and base_qs.filter(pk=pk_val).exists():
if not updated and base_qs.filter(pk=pk_val).using(using).exists():
raise ConcurrentTransition("Cannot save object! The state has been changed since fetched from the database!")

return updated
Expand Down

0 comments on commit d9effde

Please sign in to comment.