Answer the question
In order to leave comments, you need to log in
What's the best way to register/login with Django?
I am gradually mastering Django and it became necessary to register and enter by phone number. Preferably, of course, with confirmation by SMS, but not necessarily.
I know about the existence of django all-auth, and about the use of regular forms / models.
I would like to know what is the best practice in this matter?
Sample snippets are very welcome!
Answer the question
In order to leave comments, you need to log in
You can extend the jang user with the phone field, and make it as the username field
class User(auth_models.AbstractBaseUser, auth_models.PermissionsMixin):
# default fields
email = models.EmailField(unique=True)
first_name = models.CharField(max_length=255, blank=True)
last_name = models.CharField(max_length=255, blank=True)
is_staff = models.BooleanField(default=False)
is_active = models.BooleanField(default=False)
date_joined = models.DateTimeField(auto_now_add=True)
# custom fields
phone = models.CharField(blank=True, max_length=40)
USERNAME_FIELD = 'phone'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question