[Answered ]-Django Transaction did not work

1👍

I know why now.

Because my DB engine is MyISAM, that is why Transaction did not work.

people use Transaction must notice if the DB support it!

reference:https://docs.djangoproject.com/en/1.8/topics/db/transactions/#savepoints

👤Gary

1👍

Well, I will probably won’t tell you anything new that you don’t know from the docs, but by default django views work in autocommit mode so every query is immediately saved to database. If you set 'ATOMIC_REQUESTS': True, there’s no need to use @transaction.atomic because every view is already wrapper in transaction by usage of ATOMIC_REQUESTS.

Leave a comment