Django - argument of type 'WSGIRequest' is not iterable
-
06-07-2019 - |
Question
How do you fix the following Django bug when working with forms?
TypeError at /url/
argument of type 'WSGIRequest' is not iterable
Solution
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!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow