Hi All, I have ATOMIC_REQUESTS set to True in my database configuration:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'abcd', 'USER': 'user', 'PASSWORD': '', 'HOST': '', 'PORT': '', 'ATOMIC_REQUESTS': True, } } But I started getting the following error when attempting to use *select_for_update()* in one particular view: select_for_update cannot be used outside of a transaction. As the error suggests, it turns out that database queries inside this particular view are not executing inside a transaction, even though ATOMIC_REQUESTS is set to True. I tested this essentially by performing an insert within the same view and then throwing an exception -- the change was indeed committed. I'm not sure why this is occurring. Other views in my application respect the ATOMIC_REQUESTS setting, and I'm able to use select_for_update() successfully elsewhere. There is nothing special about this particular view that I can see. It's just processing a form and inserting some records. I can paste the view code if it helps, but there is really nothing remarkable about it, which leads me to believe that the problem lies elsewhere. I have no idea how to debug this. I would like all requests in my application to be wrapped in transactions, as indicated by the ATOMIC_REQUESTS setting. Any help is appreciated. Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/aebf9844-d7e1-4961-bc35-a01b05aba4bf%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.