I can see the next parameter hanging off the URL of my log_in page.
-- However, I cannot *read* it in my view code. The next parameter does NOT get
passed to my Python code...Why not? Is my form action = "." the problem below?
Here is the traceback.....
Here is my log in page...
def log_in(request):
if request.method == "POST":
form = pollster.forms.LogInForm(request.POST)
if form.is_valid():
username = form.cleaned_data["username"].lower()
password = form.cleaned_data["password"]
next = request.GET.get("next")
reply = django.shortcuts.redirect(next)
user = AUTH(username = username,
password = password)
if user:
django.contrib.auth.login(request, user)
else:
reply = django.shortcuts.render(request,
"log_in.html",
{"form" : form})
else:
form = pollster.forms.LogInForm()
reply = django.shortcuts.render(request,
"log_in.html",
{"form" : form})
return reply
Here is my template...
<!DOCTYPE html>
<html>
<head>
<title>Pollster</title>
<link type = "text/css"
href = "/static/base.css"
rel = "stylesheet">
<meta content = "text/html; charset=utf-8"
http-equiv = "content-type">
</head>
<body>
<div id = "log_in">
<form action = "." method = "post">
<p>Username:</p>
<p>{{form.username}}</p>
<p>Password:</p>
<p>{{form.password}}</p>
<p><input type = "submit" value = "Submit"/></p>
{% csrf_token %}
</form>
</div>
</body>
</html>
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bed8ec66-572d-4306-a496-edf9b69142bb%40googlegroups.com.
No comments:
Post a Comment