I try do login view and I find it on 

https://docs.djangoproject.com/en/1.8/topics/auth/default/

from django.contrib.auth import authenticate, login

def my_view(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)
            # Redirect to a success page.
        else:
            # Return a 'disabled account' error message
            ...
    else:
        # Return an 'invalid login' error message.
        ...



to give request.POST username and password and username I must create my 
own form or maybe Django have that form ready? I use Django 1.8

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/96258668-1c56-45d6-adce-59cff591dd23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to