(self, can_access_all_locations, accessible_location_ids, export_type)
return filters
Serialize the bound form as an ExportInstanceFilters object.
Serialize the bound form as an ExportInstanceFilters object.
Serialize the bound form as an ExportInstanceFilters object .
def to_export_instance_filters(self, can_access_all_locations, accessible_location_ids, export_type):
        """
        Serialize the bound form as an ExportInstanceFilters object.
        """
        # Confirm that either form filter data or case filter data but not both has been submitted.
        assert (
            (self.cleaned_data['emwf_form_filter'] is not None) !=
            (self.cleaned_data['emwf_case_filter'] is not None)
        )
        assert(export_type == 'form' or export_type == 'case')
        if export_type == 'form':
            filters = self._to_form_export_instance_filters(can_access_all_locations, accessible_location_ids)
        else:
            filters = self._to_case_export_instance_filters(can_access_all_locations, accessible_location_ids)

        if (self.can_user_access_all_locations
                and self.can_restrict_access_by_location
                and self.cleaned_data['update_location_restriction']):
            filters.accessible_location_ids = filters.locations
            filters.can_access_all_locations = not filters.locations
        return filters
def to_export_instance_filters ( self , can_access_all_locations , accessible_location_ids , export_type ) : # Confirm that either form filter data or case filter data but not both has been submitted. assert ( ( self . cleaned_data [ 'emwf_form_filter' ] is not None ) != ( self . cleaned_data [ 'emwf_case_filter' ] is not None ) ) assert ( export_type == 'form' or export_type == 'case' ) if export_type == 'form' : filters = self . _to_form_export_instance_filters ( can_access_all_locations , accessible_location_ids ) else : filters = self . _to_case_export_instance_filters ( can_access_all_locations , accessible_location_ids ) if ( self . can_user_access_all_locations and self . can_restrict_access_by_location and self . cleaned_data [ 'update_location_restriction' ] ) : filters . accessible_location_ids = filters . locations filters . can_access_all_locations = not filters . locations return filters