I want to use an email field as the username field for my custom user model. I have the following custom User model subclassing Django\'s AbstractUser model:
You can edit your CustomUser to change the email field attribute to unique=True.
Add this to the end of your custom user class like so:
class CustomUser(AbstractUser):
...
USERNAME_FIELD = 'email'
...
CustomUser._meta.get_field_by_name('email')[0]._unique=True
Note that we're changing _unique and not unique because the latter is a simple @property.
This is a hack, and I would love to hear any "official" answers to resolve this.