def post(self, request, *args, **kwargs): post_id = request.POST["post_id"] if re.search(r"^\d+$", post_id): invalidate_posts([post_id]) return HttpResponseRedirect( reverse("constituency", kwargs={"post_id": post_id, "ignored_slug": "", "election": self.election}) )
def post(self, request, *args, **kwargs): post_id = request.POST['mapit_area_id'] if re.search(r'^\d+$', post_id): invalidate_posts([post_id]) return HttpResponseRedirect( reverse('constituency', kwargs={ 'mapit_area_id': post_id, 'ignored_slug': '' }) )
def post(self, request, *args, **kwargs): post_id = request.POST['post_id'] if re.search(r'^\d+$', post_id): invalidate_posts([post_id]) return HttpResponseRedirect( reverse('constituency', kwargs={ 'post_id': post_id, 'ignored_slug': '', 'election': self.election, }))
def handle(self, *args, **kwargs): if len(args) < 1: raise CommandError("You must provide one or more PopIt person ID") for person_id in args: person = PopItPerson.create_from_popit( create_popit_api_object(), person_id ) posts_to_invalidate = person.get_associated_posts() person.delete_memberships() self.create_party_memberships(person_id, person.popit_data) self.create_candidate_list_memberships(person_id, person.popit_data) posts_to_invalidate.update(person.get_associated_posts()) invalidate_posts(posts_to_invalidate) invalidate_person(person_id)
def handle(self, *args, **kwargs): api = create_popit_api_object() if len(args) < 1: raise CommandError("You must provide one or more PopIt person ID") for person_id in args: invalidate_person(person_id) person = PopItPerson.create_from_popit(api, person_id) posts_to_invalidate = person.get_associated_posts() person.delete_memberships(api) # The memberships are recreated when you assign to # standing_in and party_memberships; this script assumes # these are correct and so re-setting these should # recreate the memberships correctly. person.standing_in = person.standing_in person.party_memberships = person.party_memberships person.save_to_popit(api) invalidate_posts(posts_to_invalidate) invalidate_person(person_id)