I know that by default, transaction is used in Django Admin when adding, changing and deleting data according to my tests.
But, I selected Delete selected persons and clicked on Go in Django Admin Actions. *I use PostgreSQL:
Then, clicked on Yes, I'm sure to delete data:
Now, only one query DELETE is run without including one or more other queries between BEGIN and COMMIT as shown below so I doubt that by default, transaction is used in Django Admin Actions. *These below are the PostgreSQL query logs and you can check how to log PostgreSQL queries :
So by default, is transaction used in Django Admin Actions?



No, by default, transaction is not used in Django Admin Actions.
First, you can see
@transaction.atomicorwith transaction.atomic():is not used for the default delete_queryset() below:Second, if you add select_for_update() code to
delete_queryset()by overriding it as shown below:Then, select Delete selected persons and click on Go in Django Admin Actions:
Then, click on Yes, I'm sure to delete data:
You will get the error below because
select_for_update()needs to be used with transaction so which means by default, transaction is not used in Django Admin Actions: