0Pricing
Django Academy · Lesson

login, logout, and Auth Views

Wire up Django's ready-made auth views.

From Verify to Logged In

Verifying a user is only step one. To keep them logged in across requests, you start a session with Django's login helper. 🔑

The login() Function

login() takes the request and an authenticated user, then saves their id in the session. Future requests now know who they are.

from django.contrib.auth import login

All lessons in this course

  1. The User Model and authenticate()
  2. login, logout, and Auth Views
  3. Registration with UserCreationForm
  4. login_required and Protecting Views
← Back to Django Academy