Complete the code to import the logout function from Django's auth module.
from django.contrib.auth import [1]
The logout function is imported from django.contrib.auth to log out users.
Complete the logout view function to call the logout method with the request.
def logout_view(request): [1](request) # redirect after logout
The logout(request) call logs out the current user by clearing the session.
Fix the error in the logout view by completing the redirect import statement.
from django.shortcuts import [1]
The redirect function is used to send users to another page after logout.
Fill both blanks to complete the logout view that logs out and redirects to home.
def logout_view(request): [1](request) return [2]('home')
The view calls logout(request) to log out the user, then redirect('home') to send them to the home page.
Fill all three blanks to create a complete logout view with import, logout call, and redirect.
from django.contrib.auth import [1] from django.shortcuts import [2] def logout_view(request): [3](request) return redirect('login')
First, import logout and redirect. Then call logout(request) to log out the user. Finally, redirect them to the login page.