Why doesn't this work?
from django.core.management.base import BaseCommand
from django.db import transaction
class Command(BaseCommand):
help = "bla bla"
def handle(self, *app_labels, **options):
from myapp.models import MyModel
transaction.enter_transaction_management()
MyModel.objects.create(name=u'FOO')
transaction.rollback()
When I run that command it does NOT roll back the transaction and
after running it I get an entry of FOO in my postgresql database.
I couldn't find any documentation for using django.db.transcation in
non-views so I guessed this was the way to run it.
(Using django trunk)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---