def _get_list_related_field(
        self,
        field: Field,
        filter_rel_field: List[Any],
        page: Optional[int] = None,
        page_size: Optional[int] = None,
    ) -> Tuple[int, List[Dict[str, Any]]]:
        """
        Return a list of values for a related field

        :param field: Marshmallow field
        :param filter_rel_field: Filters for the related field,
                expects [field_name, Type[BaseFilter], value]
        :param page: The page index
        :param page_size: The page size
        :return: Total record count and list of dict with id and value
        """
        ret = []
        count = 0
        if isinstance(field, Related) or isinstance(field, RelatedList):
            datamodel = self.datamodel.get_related_interface(field.name)
            filters = datamodel.get_filters(datamodel.get_search_columns_list())
            page, page_size = self._sanitize_page_args(page, page_size)
            order_field = self.order_rel_fields.get(field.name)
            if order_field:
                order_column, order_direction = order_field
            else:
                order_column, order_direction = "", ""
            if filter_rel_field:
                filters = filters.add_filter_list(filter_rel_field)
            count, values = datamodel.query(
                filters, order_column, order_direction, page=page, page_size=page_size
            )
            for value in values:
                ret.append({"id": datamodel.get_pk_value(value), "value": str(value)})
        return count, ret

        Return a list of values for a related field

        :param field: Marshmallow field
        :param filter_rel_field: Filters for the related field,
                expects [field_name, Type[BaseFilter], value]
        :param page: The page index
        :param page_size: The page size
        :return: Total record count and list of dict with id and value
        
flask_appbuilder/api/__init__.py