@@ -0,0 +1,1510 @@
+import json%0A%0Afrom candidates.models import PopItPerson%0Afrom candidates.popit import PopItApiMixin, get_base_url%0A%0Afrom django.core.management.base import BaseCommand%0A%0Aclass Command(PopItApiMixin, BaseCommand):%0A%0A    def handle(self, **options):%0A        message = %22WARNING: this will delete all people, posts, %22 %5C%0A            %22organizations and%5Cnmemberships from the PopIt instance:%22 + %5C%0A            %22%5Cn%5Cn  %22 + get_base_url() + %22%5Cn%5CnIf you really want to do %22 + %5C%0A            %22this, type 'YES':%22%0A        self.stdout.write(message)%0A        user_response = raw_input()%0A        if user_response != 'YES':%0A            self.stdout.write(%22Aborting, since you didn't type 'YES'.%22)%0A            return%0A        for collection in (%0A                'memberships',%0A                'posts',%0A                'organizations',%0A                'persons',%0A        ):%0A            self.stdout.write(%22Deleting from collection: %22 + collection)%0A            api_collection = getattr(self.api, collection)%0A            # We have to be careful here - if you try to step to page%0A            # 2 after deleting everything on page 1, then lots of%0A            # objects will be missed. Instead, just get the first page%0A            # until there's nothing left.%0A            while True:%0A                results = api_collection.get()%0A                for o in results%5B'result'%5D:%0A                    object_id = o%5B'id'%5D%0A                    api_collection(object_id).delete()%0A                if not results.get('has_more'):%0A                    break%0A

Add a command to delete all objects from PopIt