Use the new django transaction API

fixes #1027
see #1371