@app.task
@transaction.atomic
def my_periodic_task():
    things = get_things_for_processing()
for thing in things:
    process_thing(thing)
How to update an object or bail if it has been deleted in Django