title: Can't login after overriding default user model in Django
body: <p>I have customized default Django model and now after creating a new superuser I can't login.
  It says that login or password is invalid.</p>
  <p>models.py:</p>
  <pre class="lang-py prettyprint-override"><code>class UserProfileManager(BaseUserManager):
  
      def create_user(self, email, first_name, last_name, password=None):
          if not email:
              raise ValueError(&quot;Email is required&quot;)
  
          user = self.model(
              email = self.normalize_email(email),
              first_name = first_name,
              last_name = last_name,
              password = password
          )
          user.save(using=self._db)
          return user
  
      def create_superuser(self, email, first_name, last_name,password=None):
          user = self.create_user(
              email = self.normalize_email(email),
              password = password,
              first_name = first_name,
              last_name = last_name
          )
          user.is_admin = True
          user.is_staff = True
          user.is_superuser = True
          user.save(using=self._db)
          return user
  
  class UserProfile(AbstractBaseUser):
      GENDERS = (
          (&quot;Male&quot;, &quot;Male&quot;),
          (&quot;Female&quot;, &quot;Female&quot;),
          (&quot;Other&quot;, &quot;Other&quot;)
      )
      email = models.EmailField(max_length=150, unique=True)
      first_name = models.CharField(max_length=50, blank=True, null=True)
      last_name = models.CharField(max_length=50, blank=True, null=True)
      birth_date = models.DateField(blank=True, null=True)
      gender = models.CharField(choices=GENDERS, max_length=50, blank=True, null=True)
      location = models.CharField(max_length=150, blank=True, null=True)
      
      date_joined = models.DateTimeField(auto_now_add=True)
      last_login = models.DateTimeField(auto_now=True)
      is_admin = models.BooleanField(default=False)
      is_active = models.BooleanField(default=True)
      is_staff = models.BooleanField(default=False)
      is_superuser = models.BooleanField(default=False)
  
      objects = UserProfileManager()
  
      USERNAME_FIELD = &quot;email&quot;
      REQUIRED_FIELDS = [&quot;first_name&quot;, &quot;last_name&quot;]
  
      def __str__(self):
          return self.email
  
      def has_perm(self, perm, obj=None):
          return self.is_admin
  
      def has_module_perms(self, app_label):
          return True
  </code></pre>
  <p>settings.py:</p>
  <pre class="lang-py prettyprint-override"><code>AUTH_USER_MODEL = &quot;UserProfile.UserProfile&quot;
  AUTHENTICATION_BACKENDS = (
          'django.contrib.auth.backends.ModelBackend',
  )
  </code></pre>
  <p>So when I create a new superuser and try to login in admin panel I get an error &quot; Please enter the correct email and password for a staff account.&quot;
  I've already tried deleting database and migrations.</p>