Eg, I want this function:
from django.db import transaction
with transaction.atomic():
assert inside_transaction() == True
assert inside_transaction() == False
Is there a way to achieve this? Or is it possible to detect directly in psycopg2 if not in Django's ORM?