Closed simevo closed 11 months ago
I think I figured out what is going on here, nothing wrong with your code.
In here I set (as we normally do) ATOMIC_REQUESTS = true
as per https://docs.djangoproject.com/en/4.2/topics/db/transactions/#tying-transactions-to-http-requests.
Turns out you already wrap all changes to the DB with transaction.atomic(durable=True):
so the two approaches clash together.
I removed the setting:
--- a/django_ledger_starter/settings.py
+++ b/django_ledger_starter/settings.py
@@ -88,7 +88,6 @@ DATABASES = {
"USER": env("DATABASE_USER"),
"PASSWORD": env("DATABASE_PASSWORD"),
"TEST": {"NAME": env("DATABASE_NAME")},
- "ATOMIC_REQUESTS": True,
}
}
if "DATABASE_HOST" in env:
and the problem goes away. I'll now update https://github.com/arrobalytics/django-ledger-starter/pull/1
Describe the bug
with postgres DB and psycopg 3 driver, occurs randomly when creating entity or vendor etc.:
To Reproduce
Entity Name
andAddress Line 1
hit "Create"Expected behavior it should create the entity
Screenshots