Update to use new Django transaction handling

See https://docs.djangoproject.com/en/dev/topics/db/transactions/. Changes were introduced as of Django 1.6. Old functions are due to be deprecated in Django 1.8.