Answer the question
In order to leave comments, you need to log in
How should the role system be implemented?
There are models: User, Pupil, Teacher, Admin
User can be Pupil, Teacher, Admin
in the last three models there is a field user_id(foreign key on User)
User:
id
... (other fields)
pupil = relationship(Pupil)
teacher = relationship (Teacher)
admin = relationship(Admin)
In order to understand what roles are assigned to the user, whether it is worth creating the Roles model (the user class will have the field roles = relationship(Roles, lazy='joined')) where the fields are (role_name, user_id) or when I load a user, should I load all other models using the lazy='joined' parameter?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question