Remove 'username' field from django-allauth

Rukomoynikov picture Rukomoynikov · Oct 30, 2013 · Viewed 11.6k times · Source

When django-registration doesn't support django 1.5 and custom user model. I'm trying use django-allauth, from first look it's great product.

Problem i have - username field required, but in my app i don't have username's. So, allauth documentation says:

**Available settings:**
ACCOUNT_AUTHENTICATION_METHOD (="username" | "email" | "username_email")

Specifies the login method to use -- whether the user logs in by entering his username, e-mail address, or either one of both.

Ok, i done, and got error:

AssertionError at /accounts/signup/
No exception supplied

models.py:

class MyUser(AbstractBaseUser, PermissionsMixin):
    title = models.CharField ('Name', max_length=100)
    email = models.EmailField('Email', max_length=255, unique=True)
    ...

settings.py

ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = ('email')
AUTH_USER_MODEL = 'internboard.MyUser'

What i'm doing wrong ?

Answer

Rukomoynikov picture Rukomoynikov · Oct 30, 2013

Thanks, i found, right settings for my task:

ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USERNAME_REQUIRED = False