Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove 'username' field from django-allauth

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 ?

like image 266
Rukomoynikov Avatar asked Oct 30 '13 13:10

Rukomoynikov


People also ask

What is Allauth in Django?

Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.

Is username in Django unique?

If you want to use django's default authentication backend you cannot make username non unique. You will have to implement a class with get_user(user_id) and authenticate(request, **credentials) methods for a custom backend.


1 Answers

Thanks, i found, right settings for my task:

ACCOUNT_AUTHENTICATION_METHOD = 'email' ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_UNIQUE_EMAIL = True ACCOUNT_USERNAME_REQUIRED = False 
like image 151
Rukomoynikov Avatar answered Sep 21 '22 10:09

Rukomoynikov