class User(AbstractBaseUser, PermissionsMixin):
...
username = models.CharField(max_length=20)
email = models.EmailField(max_length=200, unique=True)
...
...
USERNAME_FIELD = "email"
REQUIRED_FIELDS = ["username"]
class Meta:
unique_together = ('username', 'email',)