Opened 2 years ago

Closed 2 years ago

#31656 closed Bug (invalid)

Help Texts in UserCreationForm cannot be overridden

Reported by: emapall Owned by: nobody
Component: Forms Version: 3.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I'm referring to this part of documentation:

While using a custom form class subclassed from django.contrib.auth.forms.UserCreationForm and overridding the help texts of the fields via the help_texts dictionary, the passwords field's help texts cannot be overridden. That is, even if in the Meta subclass i have

help_texts = {

The html renders the standard built in list (and ofc in the view that renders the template with the form, form.fields['password1'].help_text is the standard built in list too)

Overriding fine with the other fields, but not the password(s). I have tried using "password", "password1" and "password2" as dict keys (even though I'm conscious of 1 and 2 being different fields).

Change History (1)

comment:1 Changed 2 years ago by Carlton Gibson

Resolution: invalid
Status: newclosed


This is expected behaviour. See the Note at the bottom of the section you linked:

ModelForm will only generate fields that are missing from the form, or in other words, fields that weren’t defined declaratively.

The password fields on UserCreationForm are declared explicitly. You will need to override them in your subclass.

Note: See TracTickets for help on using tickets.
Back to Top