Complete the code to import the Django login view.
from django.contrib.auth.views import [1]
The LoginView is the built-in Django view to handle user login.
Complete the code to define a URL pattern for the login view.
path('login/', [1].as_view(), name='login')
as_view()The URL pattern should use LoginView.as_view() to connect the login page.
Fix the error in the login template to correctly display the username input field.
<input type="text" name="[1]" placeholder="Username">
The login form expects the input field name to be username for authentication.
Fill both blanks to complete the login template form with CSRF token and password input.
<form method="post"> {% csrf_token %} <input type="text" name="username" placeholder="Username"> <input type="[1]" name="password" placeholder="Password"> <button type="[2]">Log In</button> </form>
The password input type must be password to hide characters, and the button type should be submit to send the form.
Fill all three blanks to customize the login view with a template and redirect URL.
class CustomLoginView(LoginView): template_name = '[1]' redirect_authenticated_user = [2] next_page = '[3]'
Set template_name to the login template file, redirect_authenticated_user to True to redirect logged-in users, and next_page to the URL to redirect after login.