Django teacher students easy solution. Use separate tables, or permissions and groups? How? Other ideas?

前端 未结 1 456
轮回少年
轮回少年 2021-01-07 06:27

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 stud

1条回答
  •  时光取名叫无心
    2021-01-07 06:50

    As a rough start:

    User Table

    • user id (primary key)
    • details (name, address, phone --i.e. common to a user of the system whether student or teacher.)

    Student Table

    • user id (foreign key relationship to user table)
    • any student specific details (enrolment date, homeroom, etc.)

    Teacher Table

    • a user id (foreign key relationship to user table)
    • teacher specific stuff (seniority, salary, etc.)

    Classes Table

    • a class id (primary key).
    • details of the class

    Grades Table

    • a user id (foreign)
    • a class id (foreign) -> these two keys used for doing a grade query.
    • 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.

    0 讨论(0)
提交回复
热议问题