MCPcopy
hub / github.com/django/django / __init__

Method __init__

django/contrib/auth/forms.py:326–341  ·  view source on GitHub ↗

The 'request' parameter is set for custom auth use by subclasses. The form data comes in via the standard 'data' kwarg.

(self, request=None, *args, **kwargs)

Source from the content-addressed store, hash-verified

324 }
325
326 def __init__(self, request=None, *args, **kwargs):
327 """
328 The 'request' parameter is set for custom auth use by subclasses.
329 The form data comes in via the standard 'data' kwarg.
330 """
331 self.request = request
332 self.user_cache = None
333 super().__init__(*args, **kwargs)
334
335 # Set the max length and label for the "username" field.
336 self.username_field = UserModel._meta.get_field(UserModel.USERNAME_FIELD)
337 username_max_length = self.username_field.max_length or 254
338 self.fields["username"].max_length = username_max_length
339 self.fields["username"].widget.attrs["maxlength"] = username_max_length
340 if self.fields["username"].label is None:
341 self.fields["username"].label = capfirst(self.username_field.verbose_name)
342
343 @sensitive_variables()
344 def clean(self):

Callers

nothing calls this directly

Calls 3

capfirstFunction · 0.90
__init__Method · 0.45
get_fieldMethod · 0.45

Tested by

no test coverage detected