Exemplo n.º 1
0
class Group(db.Model):
    __tablename__ = "group"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(25), nullable=False)
    enter_date = db.Column(db.Date, nullable=False)
    students = db.relationship('Student', backref='Group', lazy='dynamic')
    courses = db.relationship('Course', backref='Group', lazy='dynamic')

    def __repr__(self):
        return 'Group %r' % self.name
Exemplo n.º 2
0
class Course(db.Model):
    __tablename__ = "course"
    id = db.Column(db.Integer, primary_key=True)
    teacher_subject = db.Column(db.Integer,
                                db.ForeignKey('teacher_subject.id'),
                                nullable=False)
    group_id = db.Column(db.Integer, db.ForeignKey('group.id'), nullable=False)
    grade = db.relationship('Grade', backref='Course', lazy='dynamic')
Exemplo n.º 3
0
class Assignment(db.Model):
    __tablename__ = "assignment"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(25))
    description = db.Column(db.String(225))
    grades = db.relationship('Grade', backref='Assignment', lazy='dynamic')

    def __repr__(self):
        return 'Assignment %r' % self.name
Exemplo n.º 4
0
class Student(Person, db.Model):
    __tablename__ = "student"
    id = db.Column(db.Integer, primary_key=True)
    government_subsidized = db.Column(db.BOOLEAN)
    group_id = db.Column(db.Integer, db.ForeignKey('group.id'), nullable=False)
    grades = db.relationship('Grade', backref='Student', lazy='dynamic')

    def __repr__(self):
        return 'Student id-{},{}'.format(self.id, self.second_name)
Exemplo n.º 5
0
class Teacher(Person, db.Model):
    __tablename__ = "teacher"
    id = db.Column(db.Integer, primary_key=True)
    hire_date = db.Column(db.Date)
    subjects = db.relationship('TeacherSubject',
                               backref='Teacher',
                               lazy='dynamic')

    def __repr__(self):
        return 'Teacher id-{},{}'.format(self.id, self.second_name)
Exemplo n.º 6
0
class Subject(db.Model):
    __tablename__ = "subject"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(25), nullable=False)
    description = db.Column(db.String(225), nullable=False)
    teachers = db.relationship('TeacherSubject',
                               backref='Subject',
                               lazy='dynamic')

    def __repr__(self):
        return 'Subject %r' % self.name
Exemplo n.º 7
0
class TeacherSubject(db.Model):
    __tablename__ = "teacher_subject"
    id = db.Column(db.Integer, primary_key=True)
    teacher_id = db.Column(db.Integer,
                           db.ForeignKey('teacher.id'),
                           nullable=False)
    subject_id = db.Column(db.Integer,
                           db.ForeignKey('subject.id'),
                           nullable=False)
    courses = db.relationship('Course',
                              backref='TeacherSubject',
                              lazy='dynamic')