I am building a web application that will enable two different types of users to log in, with each user group having access to different pages on the site.
As the information collected is similar for each type of user, I am planning to use only one custom user model with two boolean fields for each user type. The model will be defined as follows:
class My_Users(AbstractBaseUser):
...
is_active = models.BooleanField(default=True)
is_admin = models.BooleanField(default=False)
is_typeA = models.BooleanField(default=False)
is_typeB = models.BooleanField(default=False)
...
I intend to use OneToOne fields based on user IDs in other models, for both typeA and typeB users. So for example, there could be:
class Model1(models.Model):
id = models.OneToOneField(TypeA, on_delete=models.CASCADE, primary_key=True,)
...
class Model2(models.Model):
id = models.OneToOneField(TypeB, on_delete=models.CASCADE, primary_key=True,)
...
My question are the following:
1/ This will imply that some ids created in my user model will be typeA and some others will be typeB. Will this be a problem for the one to one reliationship? i.e. will it be a problem that the ids are not incremental (type A could be id 1, 3, 4, 5, etc... whilst type B could have ids 2, 6, 7, etc...) for the one-to-one relationship.
2/ Is this the best set up in order to ensure that the app is scalable. If not, what would this be?
Thanks.