Make work with Django 1.6 by putting the select_for_update() in a transaction (but in a way that will work in Django < 1.6 too).