We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
with postgres DB and psycopg 3 driver, occurs randomly when creating entity or vendor etc.:
Request Method: POST Request URL: http://localhost:8000/ledger/customer/simevo-pqr0mwbu/create/ Django Version: 4.2.8 Exception Type: RuntimeError Exception Value: A durable atomic block cannot be nested within another atomic block. Exception Location: /usr/local/lib/python3.11/site-packages/django/db/transaction.py, line 190, in __enter__ Raised during: django_ledger.views.customer.CustomerModelCreateView Python Executable: /usr/local/bin/python3 Python Version: 3.11.6 Python Path: ['/app', '/usr/local/lib/python311.zip', '/usr/local/lib/python3.11', '/usr/local/lib/python3.11/lib-dynload', '/usr/local/lib/python3.11/site-packages'] Server time: Tue, 05 Dec 2023 13:23:52 +0000
To Reproduce
Entity Name
Address Line 1
Expected behavior it should create the entity
Screenshots
The text was updated successfully, but these errors were encountered:
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.
ATOMIC_REQUESTS = true
Turns out you already wrap all changes to the DB with transaction.atomic(durable=True): so the two approaches clash together.
with transaction.atomic(durable=True):
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 arrobalytics/django-ledger-starter#1
Sorry, something went wrong.
do not set ATOMIC_REQUESTS = true
eeb9ff8
fixes: arrobalytics/django-ledger#178
elarroba
No branches or pull requests
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
![localhost_8000_ledger_customer_simevo-pqr0mwbu_create_](https://private-user-images.githubusercontent.com/8254819/288055796-b658fd9b-350e-42d6-b0ee-3e1589dfda12.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NDM2NDIsIm5iZiI6MTczODk0MzM0MiwicGF0aCI6Ii84MjU0ODE5LzI4ODA1NTc5Ni1iNjU4ZmQ5Yi0zNTBlLTQyZDYtYjBlZS0zZTE1ODlkZmRhMTIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMTU0OTAyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NWNjN2Y5NmJiMzdmMGY1Yjg2ZDUyZWQ2N2Y1MWEwMzI4MTRkNDhjNzdlOTYzMTY0YWE5NDk4MDljZTJkYzY5YSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.GCPryAkGQcqlRUQnhdFIz4VJhV92BTz-JKQmuyFgnYo)
The text was updated successfully, but these errors were encountered: