I used @transaction.non_atomic_requests
for the overridden save()
in Person
model as shown below:
# "store/models.py"
from django.db import models
from django.db import transaction
class Person(models.Model):
name = models.CharField(max_length=30)
@transaction.non_atomic_requests # Here
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
And, I also used @transaction.non_atomic_requests
for the overridden save_model()
in Person
admin as shown below:
# "store/admin.py"
from django.contrib import admin
from .models import Person
from django.db import transaction
@admin.register(Person)
class PersonAdmin(admin.ModelAdmin):
@transaction.non_atomic_requests # Here
def save_model(self, request, obj, form, change):
obj.save()
But, when adding data as shown below:
Transaction is used as shown below. *I use PostgreSQL and these logs below are the queries of PostgreSQL and you can check On PostgreSQL, how to log queries with transaction queries such as "BEGIN" and "COMMIT":
And, when changing data as shown below:
Transaction is used as shown below:
And, when clicking Delete
button of Change person as shown below:
Then clicking Yes, I'm sure
button to delete data as shown below:
Transaction is used as shown below:
And, when selecting Delete selected persons
and clicking Go
button of Select person to change as shown below:
Then clicking Yes, I'm sure
button to delete data as shown below:
Transaction is used as shown below:
So, how can I disable transaction in Django Admin?