TomFuertes
TomFuertes

Reputation: 7270

Django - argument of type 'WSGIRequest' is not iterable

How do you fix the following Django bug when working with forms?

TypeError at /url/
argument of type 'WSGIRequest' is not iterable

Upvotes: 2

Views: 1227

Answers (1)

TomFuertes
TomFuertes

Reputation: 7270

After debugging my code for ~45 minutes, I found the following line needed to pass the request dictionary of posted information instead of the request itself:

# This: 
#    job_form = JobForm(request)
# Should Be: 
job_form = JobForm(request.GET) # OR
job_form = JobForm(request.POST)

Couldn't turn anything up originally on Google. Hope this helps someone!

Upvotes: 2

Related Questions