(request, param)
return getattr(request, param)
从请求信息中获取想要的信息
从请求信息中获取想要的信息
从请求信息中获取想要的信息
def get_request_params(request, param):
    """从请求信息中获取想要的信息"""
    if not hasattr(request, param):
        preserved_filters_str = request.GET.get('_changelist_filters')
        if preserved_filters_str:
            preserved_filters = dict(parse_qsl(preserved_filters_str))
        else:
            preserved_filters = dict()
        value = (request.GET.get(param)
            or preserved_filters.get(param))
        setattr(request, param, value)
    return getattr(request, param)
def get_request_params ( request , param ) : if not hasattr ( request , param ) : preserved_filters_str = request . GET . get ( '_changelist_filters' ) if preserved_filters_str : preserved_filters = dict ( parse_qsl ( preserved_filters_str ) ) else : preserved_filters = dict ( ) value = ( request . GET . get ( param ) or preserved_filters . get ( param ) ) setattr ( request , param , value ) return getattr ( request , param )