def election_validate_create(election_id): election = Election.objects.select_for_update().get(id=election_id) election.logger.info("Spawning validate create poll tasks") if election.polls_feature_frozen: election.frozen_at = datetime.datetime.now() election.save() for poll in election.polls.all(): if not poll.feature_can_validate_create: poll_validate_create.delay(poll.id) subject = u"Election is frozen" msg = u"Election is frozen" msg = utils.append_ballot_to_msg(election, msg) election.notify_admins(msg=msg, subject=subject)