1

I didn't seem to find this specific error.

I am sending a POST to a function in django and when I try to extract the data I come across this message on the request.getlist line:

AttributeError: 'WSGIRequest' object has no attribute 'getlist'

The function is:

def function(request, a_id, b_id):
    return_val = ""
    if request.method == 'POST':
        message = request.getlist("message")

        #Stuff

    return render_to_response("return.html", {'res':return_val}, context_instance=RequestContext(request))
4

1 回答 1

2

它应该是:

message = request.POST.getlist("message")

在 HttpRequest 对象中,GET 和 POST 属性是django.http.QueryDict. getlistQueryDict的方法,而不是HttpRequest

于 2013-11-08T01:28:44.663 回答