how to remove these usercreation forms instruction in django

Viewed 333
class Driver_SignUpForm(UserCreationForm):
    class Meta(UserCreationForm.Meta):
        fields = ("username", "email", "password1", "password2")
        model = User
        help_texts = {
            'username': None,
            'email': None,
            'password1': None,
            'password2': None,
        }

this is the code i already use the help text none but not working properly here is image of that

how to remove password instructions

1 Answers

password1 and password2 aren't fields of the User model, so adding them to the fields list and trying to override the help texts in Meta doesn't do anything. That only works when you want to override model fields.

You should just redefine them at the top of your form, copying them from the django.contrib.auth.forms.UserCreationForm and removing the help texts.

class DriverSignUpForm(UserCreationForm):

    password1 = forms.CharField(
        label=_("Password"),
        strip=False,
        widget=forms.PasswordInput,
    )
    password2 = forms.CharField(
        label=_("Password confirmation"),
        widget=forms.PasswordInput,
        strip=False,
    )
    class Meta(UserCreationForm.Meta):
        fields = ("username", "email")

Related