Skip to content Skip to sidebar Skip to footer

Http Request Object Does Not Respond

I am making a login form in Django. When I am click on login submit button , It gives an error of ValueError at /registration/ The view registration.views.login didn't return an H

Solution 1:

Your login view will return a HttpResponse for a POST request only (on form submit). When you address your browser to login page, it makes a GET request, which is not handled in your view

I`ll recomend you to read more about user athentication: doc.

And as mentioned, use render or render_to_response functions from django.shortcuts

Solution 2:

Instead of direct_to_template you may want to use render_to_response which renders a given template and returns HttpResponse.

Refer render_to_response. Note; you will have to import it using from django.shortcuts import render_to_response

Solution 3:

Why not you are using render_to_response ?

The answer of your question is you are not returning the Httpresponse object

If your login is successful then only you will be redirect to success .

Try this

return render_to_response(your_template_name, 
                              context_instance=RequestContext(request))

Don't forget to import context_instance like

from django.templateimport RequestContext

Post a Comment for "Http Request Object Does Not Respond"