db.transaction.non_atomic_requests()

non_atomic_requests(using=None) [source]

This decorator will negate the effect of ATOMIC_REQUESTS for a given view:

from django.db import transaction

@transaction.non_atomic_requests
def my_view(request):
    do_stuff()

@transaction.non_atomic_requests(using='other')
def my_other_view(request):
    do_stuff_on_the_other_database()

It only works if it’s applied to the view itself.

doc_Django
2016-10-09 18:36:27
Comments
Leave a Comment

Please login to continue.