Database transactions

Database transactions

Django gives you a few ways to control how database transactions are managed.

Managing database transactions

Django’s default transaction behavior

Django’s default behavior is to run in autocommit mode. Each query is immediately committed to the database, unless a transaction is active. See below for details.

Django uses transactions or savepoints automatically to guarantee the integrity of ORM operations that require multiple queries, especially delete() and 登录查看完整内容