Update transaction middleware to Django's "Atomic" API

(Well, not using Atomic itself as I don't exactly see how it can be split
right this second, and using it would prevent a task from being able to
COMMIT manaully..)

Anyway, the rewrite meant that "is_managed" started always returning a
False value, so we never performed a COMMIT at all as the latter is
protected by checking the former as a conditional. This presumably
left that connection with a transaction that was never committed whilst
it processed 1000s of queue jobs (!).

I think it's worse than that though (although I can't confirm yet) - when
a queue job actually exceptioned - that massive transaction would have
have been rolled back. Transactions are cheap in postgres as it's just
changing what is visible at all, but the timings with our recent spurts
of downtime have been very suspicious, happening 3 or 4 days after the
Atomic change was pushed.

Signed-off-by: Chris Lamb <chris@thread.com>