windows下使用mingw进行编译

get_queryset应该不行吧 主要是需要修改查询条件,把choice的查询条件,从value修改为对应的key

ROLE_CHOICES = (
        (1, '会员'),
        (2, '店铺'),
        (3, '经纪人'),
    )

def get_search_results(self, request, queryset, search_term):
        search_term_list = get_choice_search_term_list(
            search_term, User.ROLE_CHOICES)

        return super().get_search_results(request, queryset, ' '.join(search_term_list))

def choices_value_info(choices):
    return {v: k for k, v in choices}


def get_choice_search_term_list(search_term, choices):
    search_term_list = search_term.split()
    choice_info = choices_value_info(choices)

    for index, bit in enumerate(search_term_list):
        if bit in choice_info:
            search_term_list[index] = str(choice_info[bit])

    return search_term_list

所有表都是这样的 应该和model admin没关系