Fix badly nested transactions in django >= 1.6