Authentication with Multiple User

43 views
Skip to first unread message

Ridwan Adeyemo

unread,
Jun 29, 2021, 1:05:04 PM6/29/21
to Django users
Hello,
How do I implement a multiple users registration/signup form. For example the user needs to have (username, name password,  and confirm password ) while the seller is going to have (Business Name, Business Email, address, tax id,  phone number and password,  and confirm password)
Best Regards.

Joel Tanko

unread,
Jul 6, 2021, 4:39:16 PM7/6/21
to django...@googlegroups.com

If what you're trying to do is have two types of user accounts, then you'd have to create a base user model and have personal and business inherit from it - and it being a subclass of AbstractBaseUser

class BaseAccount(AbstractBaseUser):
    …
    # all public fields

class PersonalAccount(BaseAccount):
    …
    # personal account only fields

class BusinessAccount(BaseAccount):
    ...
    # business account only fields

# settings.py

AUTH_USER_MODEL = 'app_name.BaseAccount'

you should avoid use of the BaseAccount directly

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/30ae9b3c-6b0d-42eb-9804-92a2fb29b26bn%40googlegroups.com.

Ridwan Adeyemo

unread,
Jul 7, 2021, 2:58:15 PM7/7/21
to django...@googlegroups.com
Thanks a lot for this I would try it as soon as possible.
Best Regards.

On Tue, Jul 6, 2021, 9:39 PM Joel Tanko <7tho...@gmail.com> wrote:

If what you're trying to do is have two types of user accounts, then you'd have to create a base user model and have personal and business inherit from it - and it being a subclass of AbstractBaseUser

class BaseAccount(AbstractBaseUser):
    …
    # all public fields

class PersonalAccount(BaseAccount):
    …
    # personal account only fields

class BusinessAccount(BaseAccount):
    ...
    # business account only fields

# settings.py

AUTH_USER_MODEL = 'app_name.BaseAccount'

you should avoid use of the BaseAccount directly

On Jun 29, 2021 6:05 PM, "Ridwan Adeyemo" <adesolar...@gmail.com> wrote:
Hello,
How do I implement a multiple users registration/signup form. For example the user needs to have (username, name password,  and confirm password ) while the seller is going to have (Business Name, Business Email, address, tax id,  phone number and password,  and confirm password)
Best Regards.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/-z05lOd9H8E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJ4Kmg4TWcEMptdOinqjyqhu%2B-tiVQdwXCg2_9N5%3DG0z_%3DRgvg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages