def model_to_select_list(model_class, filter_dict=None, q_filter=None):
    """
    只选择 id 和 name，用来做列表选择
    :param model_class:
    :param filter_dict:
    :param q_filter:
    :return:
    """
    if filter_dict is None:
        filter_dict = {}

    if q_filter is not None:
        filter_list = [q_filter]
    else:
        filter_list = []

    objects = model_class.objects.filter(
        *filter_list, **filter_dict).values('id', 'name')

    return list(objects)
def model_to_select_list ( model_class , filter_dict = None , q_filter = None ) : if filter_dict is None : filter_dict = { } if q_filter is not None : filter_list = [ q_filter ] else : filter_list = [ ] objects = model_class . objects . filter ( * filter_list , ** filter_dict ) . values ( 'id' , 'name' ) return list ( objects )
只选择 id 和 name，用来做列表选择
    :param model_class:
    :param filter_dict:
    :param q_filter:
    :return: