Implement transaction.atomic in django 1.4/1.5 way

Fix #3062
Implements a wrapper to make every supported version happy.

This is required by #3222