title: why does clean_password2() method work but not clean_password1() in Django usercreationform
body: <p>I am trying to figure out why this works if someone could maybe explain it to me.</p>
  <p>I've just created a custom user model (shown below) and for the password validation it uses the <code>clean_password2(self):</code> (shown below) method however when I try to use <code>clean_password1(self):</code> (shown below) the validation does not work. why? Surely using either <code>password1</code> or <code>password2</code> to clean the data would work since they are the same?</p>
  <p>Django docs state that we can use <code>clean_&lt;fieldname&gt;():</code> methods to clean/validate data and since <code>password1</code> is a fieldname in my mind that should work.</p>
  <h3>Custom user model</h3>
  <pre><code>class UserManager(BaseUserManager):
      def create_user(self, email, password=None):
          if not email:
              raise ValueError(&quot;Users must have an email address&quot;)
  
          user = self.model(email=self.normalize_email(email))
  
          user.set_password(password)
          user.save(using=self._db)
          return user
  
      def create_superuser(self, email, password=None):
          user = self.create_user(email=email, password=password)
          user.is_staff = True
          user.is_admin = True
          user.save(using=self._db)
          return user
  
  
  class User(AbstractBaseUser):
      first_name = models.CharField(max_length=255)
      last_name = models.CharField(max_length=255)
      email = models.EmailField(verbose_name=&quot;Email Address&quot;, max_length=255, unique=True)
  
      is_active = models.BooleanField(default=True)
      is_staff = models.BooleanField(default=False)
      is_admin = models.BooleanField(default=False)
  
      objects = UserManager()
  
      USERNAME_FIELD = &quot;email&quot;
      REQUIRED_FIELDS = []
  
      def __str__(self):
          return self.email
  
      def has_perm(self, perm, obj=None):
          return True
  
      def has_module_perms(self, app_label):
          return True
  </code></pre>
  <h3>This works</h3>
  <pre><code>class UserCreationForm(forms.ModelForm):
  
      password1 = forms.CharField(
          label=&quot;Password&quot;,
          help_text=password_validation.password_validators_help_text_html(),
          widget=forms.PasswordInput,
      )
      password2 = forms.CharField(
          label=&quot;Confirm Password&quot;,
          help_text=&quot;Enter the same password as before for validation&quot;,
          widget=forms.PasswordInput,
      )
  
      class Meta:
          model = User
          fields = [&quot;email&quot;]
      
  
      def clean_password2(self):
          # Check that the two password entries match
          password1 = self.cleaned_data.get(&quot;password1&quot;)
          password2 = self.cleaned_data.get(&quot;password2&quot;)
  
          if password1 and password2 and password1 != password2:
              raise ValidationError(&quot;Passwords don't match&quot;)
          return password2
  
      def save(self, commit=True):
          # Save the provided password in hashed format
          user = super().save(commit=False)
          user.set_password(self.cleaned_data[&quot;password1&quot;])
          if commit:
              user.save()
          return user
  </code></pre>
  <h3>This doesn't</h3>
  <pre><code>def clean_password1(self):
     # Check that the two password entries match
     password1 = self.cleaned_data.get(&quot;password1&quot;)
     password2 = self.cleaned_data.get(&quot;password2&quot;)
  
     if password1 and password2 and password1 != password2:
        raise ValidationError(&quot;Passwords don't match&quot;)
     return password1
  </code></pre>