system-pri/backend/app/students/models.py

29 lines
1.1 KiB
Python
Raw Normal View History

from ..dependencies import db
from ..base.models import Person, Base
class ProjectSupervisor(Base, Person):
__tablename__ = "project_supervisors"
limit_group = db.Column(db.Integer, default=1, nullable=False)
mode = db.Column(db.Boolean, default=True, nullable=False) # True - stationary, False - non-stationary
class Group(Base):
__tablename__ = "groups"
name = db.Column(db.String(60), nullable=False)
project_supervisor_id = db.Column(db.Integer, db.ForeignKey('project_supervisors.id'))
project_supervisor = db.relationship('ProjectSupervisor', backref='groups', lazy=True)
class Student(Person):
__tablename__ = "students"
index = db.Column(db.Integer, primary_key=True)
first_term = db.Column(db.Integer, default=0, nullable=False)
second_term = db.Column(db.Integer, default=0, nullable=False)
group_id = db.Column(db.Integer, db.ForeignKey('groups.id'))
group = db.relationship('Group', backref='students', lazy=True)
mode = db.Column(db.Boolean, default=True, nullable=False) # True - stationary, False - non-stationary