def post(self, request, *args, **kwargs):
     person_id = request.POST['person_id']
     if re.search(r'^\d+$', person_id):
         invalidate_person(person_id)
     return HttpResponseRedirect(
         reverse('person-view', kwargs={
             'person_id': person_id
         })
     )
 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)
Exemple #4
0
 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)
 def post(self, request, *args, **kwargs):
     person_id = request.POST["person_id"]
     if re.search(r"^\d+$", person_id):
         invalidate_person(person_id)
     return HttpResponseRedirect(reverse("person-view", kwargs={"person_id": person_id}))
 def post(self, request, *args, **kwargs):
     person_id = request.POST['person_id']
     if re.search(r'^\d+$', person_id):
         invalidate_person(person_id)
     return HttpResponseRedirect(
         reverse('person-view', kwargs={'person_id': person_id}))