Cannot redirect after login

11 views
Skip to first unread message

youngjin...@gmail.com

unread,
Dec 28, 2007, 12:39:49 PM12/28/07
to Django users
Hello,

I was following the chapter 12 of the django book and had a redirect
problem after login. I cannot redirect to the page I want. I found the
following trick from the Django user group, but it did not work for
me. I was always taken to the /accounts/profile/ even with your code.
Here is what I have in my login.html

<form action='.' method='post'>
<label for="username">User name:</label>
<input type="text" name="username" value="" id="username">
<label for="password">Password:</label>
<input type="password" name="password" value="" id="password">
<input type="submit" value="login" />
<input type="hidden" name="next" value="{% if next %}{{ next }}{%
else %}/{% endif %}">
<form action='.' method='post'>

I correctly set the value of the "next" hidden field, but it did not
work. I am always taken to the /accounts/profile/ page. Could someone
explain why?

Also, I don't understand what the last <form> tag is for, either. Any
help would be greatly appreciated.

Thanks in advance.

Empty

unread,
Dec 28, 2007, 2:48:51 PM12/28/07
to django...@googlegroups.com
> Also, I don't understand what the last <form> tag is for, either. Any
> help would be greatly appreciated.
>
The last form tag is an error. It should be the closing form tag

</form>

Fix that and see if your problem persists.

Michael Trier
blog.michaeltrier.com

youngjin...@gmail.com

unread,
Dec 30, 2007, 2:51:31 PM12/30/07
to Django users
Thanks, Michael,

That solved the problem.

YJ
Reply all
Reply to author
Forward
0 new messages