1 from django
import forms
2 from django
.contrib
.admin
.forms
import AdminAuthenticationForm
5 class CustomAdminAuthenticationForm(AdminAuthenticationForm
):
7 def clean_username(self
):
8 username
= self
.cleaned_data
.get('username')
9 if username
== 'customform':
10 raise forms
.ValidationError('custom form error')