Reputation: 2162
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))
Upvotes: 1
Views: 3365
Reputation:
It should be:
message = request.POST.getlist("message")
In an HttpRequest object, the GET and POST attributes are instances of django.http.QueryDict
. getlist
is method of QueryDict and not HttpRequest
.
Upvotes: 2