def model_to_page_list(model_class, page_num,
                       page_size=DEFAULT_PAGE_SIZE,
                       filter_dict=None, order_by_list=None,
                       select_related_fields=None, q_filter=None,
                       values=None, to_json_method='to_json',
                       max_page_size=MAX_PAGE_SIZE):
    """
    :param max_page_size:
    :param model_class:
    :param page_num:
    :param page_size:
    :param filter_dict:
    :param order_by_list:
    :param select_related_fields:
    :param q_filter: Q(uuid__contains=keyword) | Q(memo__contains=keyword)
    :param values:
    :param to_json_method:
    :return:
    """
    if order_by_list is None:
        order_by_list = ['-id']

    if filter_dict is None:
        filter_dict = {}

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

    if select_related_fields is None:
        if values is None:
            objects = model_class.objects.filter(
                *filter_list, **filter_dict).order_by(*order_by_list)
        else:
            objects = model_class.objects.filter(
                *filter_list, **filter_dict).values(*values).order_by(*order_by_list)
    else:
        if values is None:
            fields = [t.attname for t in model_class._meta.fields]
        else:
            fields = values
        fields.extend(select_related_fields)
        objects = model_class.objects.filter(
            *filter_list, **filter_dict).values(*fields).order_by(*order_by_list)

    if page_num is not None:
        if page_size > max_page_size:
            page_size = max_page_size

        paginator = Paginator(objects, page_size)
        try:
            json_list = paginator.page(page_num)
        except EmptyPage as e:
            json_list = []
    else:
        json_list = list(objects)

    if select_related_fields is not None or values is not None:
        json_list = [object_set_dict_data(model_class, t) for t in json_list]
    return [getattr(t, to_json_method)() for t in json_list]
:param max_page_size:
    :param model_class:
    :param page_num:
    :param page_size:
    :param filter_dict:
    :param order_by_list:
    :param select_related_fields:
    :param q_filter: Q(uuid__contains=keyword) | Q(memo__contains=keyword)
    :param values:
    :param to_json_method:
    :return: