(cls, export_instance_filters, domain, export_type)
Return a dictionary representing the form data from a given ExportInstanceFilters.
        This is used to populate a form from an existing export instance
        :param export_instance_filters:
        :return:
Return a dictionary representing the form data from a given ExportInstanceFilters.
        This is used to populate a form from an existing export instance
        :param export_instance_filters:
        :return:
Return a dictionary representing the form data from a given ExportInstanceFilters . This is used to populate a form from an existing export instance : param export_instance_filters : : return :
def get_form_data_from_export_instance_filters(cls, export_instance_filters, domain, export_type):
        """
        Return a dictionary representing the form data from a given ExportInstanceFilters.
        This is used to populate a form from an existing export instance
        :param export_instance_filters:
        :return:
        """
        if export_instance_filters:
            date_period = export_instance_filters.date_period
            selected_items = (
                export_instance_filters.users +
                export_instance_filters.reporting_groups +
                export_instance_filters.locations +
                export_instance_filters.user_types
            )
            if isinstance(export_instance_filters, CaseExportInstanceFilters):
                selected_items += (
                    export_instance_filters.sharing_groups +
                    (["all_data"] if export_instance_filters.show_all_data else []) +
                    (["project_data"] if export_instance_filters.show_project_data else [])
                )

            emwf_utils_class = CaseListFilterUtils if export_type is CaseExportInstance else \
                EmwfUtils
            emwf_data = []
            for item in selected_items:
                choice_tuple = emwf_utils_class(domain).id_to_choice_tuple(str(item))
                if choice_tuple:
                    emwf_data.append({"id": choice_tuple[0], "text": choice_tuple[1]})

            return {
                "date_range": date_period.period_type if date_period else None,
                "days": date_period.days if date_period else None,
                "start_date": date_period.begin if date_period else None,
                "end_date": date_period.end if date_period else None,
                "emwf_form_filter": emwf_data,
                "emwf_case_filter": emwf_data,
            }
        else:
            return None
def get_form_data_from_export_instance_filters ( cls , export_instance_filters , domain , export_type ) : if export_instance_filters : date_period = export_instance_filters . date_period selected_items = ( export_instance_filters . users + export_instance_filters . reporting_groups + export_instance_filters . locations + export_instance_filters . user_types ) if isinstance ( export_instance_filters , CaseExportInstanceFilters ) : selected_items += ( export_instance_filters . sharing_groups + ( [ "all_data" ] if export_instance_filters . show_all_data else [ ] ) + ( [ "project_data" ] if export_instance_filters . show_project_data else [ ] ) ) emwf_utils_class = CaseListFilterUtils if export_type is CaseExportInstance else EmwfUtils emwf_data = [ ] for item in selected_items : choice_tuple = emwf_utils_class ( domain ) . id_to_choice_tuple ( str ( item ) ) if choice_tuple : emwf_data . append ( { "id" : choice_tuple [ 0 ] , "text" : choice_tuple [ 1 ] } ) return { "date_range" : date_period . period_type if date_period else None , "days" : date_period . days if date_period else None , "start_date" : date_period . begin if date_period else None , "end_date" : date_period . end if date_period else None , "emwf_form_filter" : emwf_data , "emwf_case_filter" : emwf_data , } else : return None