Answer the question
In order to leave comments, you need to log in
How to organize authorization in Django with multiple applications?
There is a project with two applications - for issuing pages (browser view) and for api (mobile application). Both must use the same user model. What is the (ideologically) correct way to do this? Start a separate application for users? But what to insert into it besides the actual model?
I know that you can simply add users to the model of one of the first two applications, and simply import it in the second, but it seems that this is somehow ugly - after all, the applications are equal, and the model will be in one of them.
Answer the question
In order to leave comments, you need to log in
#myuserapp/models.py
class MyUser(AbstractUser):
....
#app1/models.py
from myuserapp.models import MyUser
class MyThingInApp1(models.Model):
user = models.ForeignKey(MyUser)
....
#app2/models.py
from myuserapp.models import MyUser
class MyThingInApp2(models.Model):
user = models.ForeignKey(MyUser)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question