0
0
Djangoframework~10 mins

Password change and reset in Django - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Django view for password change.

Django
from django.contrib.auth.views import [1]
Drag options to blanks, or click blank then click option'
APasswordChangeView
BLoginView
CLogoutView
DPasswordResetView
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing views related to login or logout instead of password change.
Confusing PasswordChangeView with PasswordResetView.
2fill in blank
medium

Complete the URL pattern to use Django's password reset view.

Django
path('reset/', [1].as_view(), name='password_reset')
Drag options to blanks, or click blank then click option'
APasswordResetView
BPasswordChangeView
CLoginView
DLogoutView
Attempts:
3 left
💡 Hint
Common Mistakes
Using PasswordChangeView instead of PasswordResetView for reset URLs.
Using login or logout views mistakenly.
3fill in blank
hard

Fix the error in the password change form import statement.

Django
from django.contrib.auth.forms import [1]
Drag options to blanks, or click blank then click option'
APasswordResetForm
BPasswordChangeForm
CAuthenticationForm
DUserCreationForm
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing PasswordChangeForm with PasswordResetForm.
Importing unrelated forms like AuthenticationForm.
4fill in blank
hard

Fill both blanks to complete the password reset confirm URL pattern.

Django
path('reset/<uidb64>/<[1]>/', [2].as_view(), name='password_reset_confirm')
Drag options to blanks, or click blank then click option'
Atoken
Buid
CPasswordResetConfirmView
DPasswordChangeView
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'uid' instead of 'token' in the URL parameter.
Using PasswordChangeView instead of PasswordResetConfirmView.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension filtering users with active status and mapping usernames to emails.

Django
user_emails = {user.[1]: user.[2] for user in users if user.[3]
Drag options to blanks, or click blank then click option'
Ausername
Bemail
Cis_active
Dis_staff
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'is_staff' instead of 'is_active' for filtering.
Mixing up username and email in keys and values.