@@ -0,0 +1,1305 @@
+%22%22%22%0AATTENTION!%0AIf you see this file after the year 2015, please delete it immediately.%0A%22%22%22%0Aimport sys%0Afrom django.core.management.base import BaseCommand%0Afrom datetime import datetime%0Afrom corehq.apps.sofabed.models import FormData%0Afrom corehq.pillows.xform import XFormPillow%0Afrom corehq.pillows.reportxform import ReportXFormPillow%0Afrom pillowtop.feed.interface import Change%0A%0A%0Aclass Command(BaseCommand):%0A    help = (%22Send all form submitted between Oct 28 7:30am UTC and 8:10am UTC%22%0A            %22to elasticsearch.  I checked, there are 4697 of 'em%22)%0A%0A    def handle(self, *args, **options):%0A        start = datetime(2015, 10, 28, 7, 0)%0A        end = datetime(2015, 10, 28, 9, 0)%0A        # I didn't see any couch views which can get forms in a date range%0A        # without a domain, so I'm using FormData.%0A        form_ids = (FormData.objects.filter(received_on__range=(start, end))%0A                    .values_list('instance_id', flat=True))%0A%0A        msg = %22Really resave %7B%7D forms? (y/n)%5Cn%22.format(len(form_ids))%0A        if raw_input(msg) != %22y%22:%0A            print %22cancelling%22%0A            sys.exit()%0A%0A        for form_id in form_ids:%0A            XFormPillow().processor(Change(id=form_id, sequence_id=None), None)%0A            ReportXFormPillow().processor(Change(id=form_id, sequence_id=None), None)%0A

Add one off mgmt cmd to resubmit some forms to ES