Workaround for issue celery/django-celery#289. Wrap commit calls in
checks for whether we are under managed transactions.