2

How can i create multiple user types with multiple authentication method. Consider the following scenario.

User Types: Admin, Staff, User, Writer, Business

  1. Admin and Staff types are need to authenticate with company email address and password
  2. Staff and Writer types are need to authenticate only with phone number. (no password)
  3. Business type is need to authenticate with email(any) and password.

How can I create Django models, according to above example.

Uzama Zaid
  • 374
  • 3
  • 10
  • Creating different user models with abstractuser. then you can customize the users regarding your login method. and AUTHENTICATION_BACKENDS also allows you to define this in setting.py in multiple ways. this document will: help.https://docs.djangoproject.com/en/1.8/topics/auth/customizing/ – sabcan Oct 23 '20 at 14:39
  • Can we create multiple model that inherit abstractuser? – Uzama Zaid Oct 23 '20 at 14:41
  • of course you can create. example: https://stackoverflow.com/questions/16682042/subclassing-abstractuser-in-django-for-two-types-of-users – sabcan Oct 23 '20 at 17:38
  • But, we cannot define both email and phone_number field. – Uzama Zaid Oct 23 '20 at 18:01

0 Answers0