问题描述
您如何处理以下问题?
有老师和学生。学生不能查看专门针对教师的页面,教师可以查看专门针对学生的页面。教师可以列出他们所教授的刚才的学生。我希望老师和学生都可以使用用户的身份登录。
How would you cope with following problem? There are teachers, and students. Student can not view pages dedicated to teachers, and teachers can view pages dedicated to students. Teachers can have list of just students they teach. I want both teachers and students to use build in User to let them login.
我有以下想法:
用户外语教师和学生分开表格建立用户? - 但问题是,我可以轻松地呈现页面,区分谁是老师,谁是学生。
Separate table for teacher and student with foreign key to build in user? - but the question is, can I easily render pages and distinguish who is teacher and who is student.
权限?组?只有一个表用户?但是说实话,我没有找到如何设法实现我刚开始提到的那样。
Permissions? Groups? and just one table Users? But to be honest I did not find the way how could I manage to achieve that what I mentioned at the beginning.
感谢任何想法,建议和意见,因为我正在考虑一下HOURS!
Would be grateful for any ideas, suggestions and comments, as I am thinking of it for HOURS!
推荐答案
作为一个粗略的开始:
用户表
- 用户ID(主键) li>
- 详细信息(姓名,地址,电话 - 系统用户的常见用户是学生还是老师)
学生表
- 用户ID(与用户表的外键关系)
- 任何学生具体细节(注册日期,会议室等)
strong>
Teacher Table
- 用户ID(与用户表的外键关系)
- 资历,工资等)
类表
- class id(primary key)。
- 课程细节
成绩表
- 用户标识(外部)
- 一个类id(外部) - >这两个键用于进行成绩查询。
- a grade
(如果学生可以多次上课,并且有多个成绩,成绩表将需要有自己的密钥,可能有序列类型来建立他们收到的顺序他们)。
(if a student can take a class multiple times, and have multiple grades, the grades table will need to have its own key, possibly with sequence type to establish the order in which they received them).
您正在显示用户的页面可以查询用户表显示该信息,其次是学生或教师的具体信息。如果学生可以成为老师,那么你也可以这么做。
Your page that is displaying the user can query the user table display that information, followed by their student or teacher specific information. If its possible for a student to be a teacher, then you're able to do that too.
这篇关于Django老师学生容易解决。使用单独的表或权限和组?怎么样?其他想法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!