Skip to content Skip to sidebar Skip to footer

Issue With Django-forms: 'wsgirequest' Object Has No Attribute 'get'

I am getting this error in the Django debug-view: 'WSGIRequest' object has no attribute 'get' This is for a login-script, which most of is copied from the admin-code, mostly for p

Solution 1:

The problem is in these lines:

form = authentication_form(request, data=request.POST)
...
form = authentication_form(request)

Your LoginForm class' init method does not take a request object like the AuthenticationForm from django.contrib.auth.forms does.

So you could just do:

form = authentication_form(data=request.POST)
...
form = authentication_form()

...but probably in fact your current LoginForm class does not do enough and you should look at the Django one (particularly the stuff around checking session cookie etc), possibly sub-class it.

Post a Comment for "Issue With Django-forms: 'wsgirequest' Object Has No Attribute 'get'"