@@ -0,0 +1,1070 @@
+# -*- coding: utf-8 -*-%0A%0A# Akvo Reporting is covered by the GNU Affero General Public License.%0A# See more details in the license.txt file located at the root folder of the Akvo RSR module.%0A# For additional details on the GNU license please see %3C http://www.gnu.org/licenses/agpl.html %3E.%0A%0A%0Afrom django.core.management.base import BaseCommand%0A%0Afrom akvo.rsr.models import ProjectContact%0A%0A%0Aclass Command(BaseCommand):%0A    help = u%22Remove ProjectContacts for all the given projects.%22%0A%0A    def add_arguments(self, parser):%0A        parser.add_argument(%0A            'project_ids',%0A            action='store',%0A            nargs='+',%0A            help='IDs of projects where contacts should be deleted'%0A        )%0A%0A    def handle(self, *args, **options):%0A        project_ids = options%5B'project_ids'%5D%0A        contacts = ProjectContact.objects.filter(project_id__in=project_ids)%0A        count = contacts.count()%0A        if count %3E 0:%0A            print('Deleting %7B%7D contacts'.format(count))%0A            contacts.delete()%0A        else:%0A            print('No contacts found to delete')%0A

Add script to delete ProjectContacts given project ids