Skip to main content

AdminAuthenticationForm

A custom authentication form used in the admin app.

Attributes

AttributeTypeDescription
error_messagesdictA dictionary of error messages used to override the default login failure text with a specific message requiring staff account credentials.
required_css_classstring = "required"The CSS class name applied to form field widgets that are marked as mandatory for successful form validation.

Constructor

Signature

def AdminAuthenticationForm()

Methods


confirm_login_allowed()

@classmethod
def confirm_login_allowed(
user: [User](../../auth/models/user.md?sid=django_contrib_auth_models_user)
) - > null

Validates that the authenticated user has staff privileges required to access the admin interface.

Parameters

NameTypeDescription
user[User](../../auth/models/user.md?sid=django_contrib_auth_models_user)The user object representing the account attempting to authenticate.

Returns

TypeDescription
nullNothing if the user is permitted to log in; otherwise, a ValidationError is raised.