On Tue, Jul 5, 2011 at 2:10 AM, TuckFrance <[email protected]> wrote:
> Having problems with getting login to work even though it's well
> documented. The pages for success, invalid, and no info provided
> aren't getting used at all. Instead, clicking login always redirects
> to /login which is not what I want. Any ideas?
>
> URLconf:
> ...
> (r'^accounts/login/$', 'django.contrib.auth.views.login'),
>
> View:
> ...
> def login(request):
          ^^^^^^^
>    username = request.POST['username']
>    password = request.POST['password']
>    user = authenticate(username=username, password=password)
>    if user is not None:
>        if user.is_active:
>            login(request, user)
           ^^^^^^^^^^^

You're calling a function called 'login' from inside a function called
'login'. It's not going to end well. Either call your login view
function something else, or import django.contrib.auth.login using a
different name (from django.contrib.auth import login as
django_login).

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to