def prepare_form_multimedia(self, in_data): """Gets the download_id for the multimedia zip and sends it to the exportDownloadService in download_export.ng.js to begin polling for the zip file download. """ try: filter_form_data, export_specs = self._get_form_data_and_specs(in_data) filter_form = FilterFormExportDownloadForm( self.domain_object, self.timezone, filter_form_data ) if not filter_form.is_valid(): raise ExportFormValidationException( _("Please check that you've submitted all required filters.") ) download = DownloadBase() export_object = self.get_export_schema(self.domain, export_specs[0]['export_id']) task_kwargs = filter_form.get_multimedia_task_kwargs( export_object, download.download_id ) from corehq.apps.reports.tasks import build_form_multimedia_zip download.set_task(build_form_multimedia_zip.delay(**task_kwargs)) except Exception as e: return format_angular_error(e) return format_angular_success({ 'download_id': download.download_id, })
def get_filters(self, filter_form_data): filter_form = FilterFormExportDownloadForm( self.domain_object, self.timezone, filter_form_data) if not filter_form.is_valid(): raise ExportFormValidationException() form_filter = filter_form.get_form_filter() export_filter = SerializableFunction(default_form_filter, filter=form_filter) return export_filter