Use the new django transaction API

fixes #1027