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
0👍
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
- [Answer]-Django – Remove the Checkbox in ClearableFileInput widget
- [Answer]-Geodjango foreignkey by distance
- [Answer]-Django extend own custom form
- [Answer]-How to graph relations between my models
- [Answer]-Insert to foreign key-linked table in django admin interface
0👍
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.template import RequestContext
- [Answer]-HTTPError when sending POST with urllib2 with params
- [Answer]-Many-to-many relationship and function parameter's default value
- [Answer]-Where should I put a validation method that would be considered best practice?