Пример #1
0
class Curriculum(db.Model):
    course_id = db.Column(db.Integer,
                          db.ForeignKey("course.id"),
                          primary_key=True)
    group_num = db.Column(db.Integer,
                          db.ForeignKey("group.num"),
                          primary_key=True)
Пример #2
0
class Student(db.Model):
    user_id = db.Column(db.Integer, db.ForeignKey("user.id"), primary_key=True)
    group_num = db.Column(db.Integer,
                          db.ForeignKey("group.num"),
                          primary_key=True)
    entry_year = db.Column(db.Integer, nullable=False)
    is_pay = db.Column(db.Boolean)
Пример #3
0
class Answer(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey("user.id"))
    homework_id = db.Column(db.Integer, db.ForeignKey("homework.id"))
    answer = db.Column(db.String)
    submit_date = db.Column(db.DateTime)

    def __repr__(self):
        return f"<Answer(answer={self.answer}, submit_date={self.submit_date})>"
Пример #4
0
class Homework(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    valid_from = db.Column(db.DateTime)
    valid_to = db.Column(db.DateTime)
    description = db.Column(db.String)
    course_id = db.Column(db.Integer, db.ForeignKey("course.id"))
    answers = db.relationship("Answer", backref="homework", lazy="dynamic")

    def __repr__(self):
        return (
            f"<Homework(name={self.name}, valid_from={self.valid_from}, valid_to={self.valid_to},"
            f"description={self.description}, course_id={self.course_id})>")
Пример #5
0
class Material(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    text = db.Column(db.String)
    date = db.Column(db.DateTime)
    course_id = db.Column(db.Integer, db.ForeignKey("course.id"))

    def __repr__(self):
        return "<Material(name='%s', name='%s', 'text'='%s')>" % (
            self.name,
            self.name,
            self.text,
        )
Пример #6
0
class Moderator(db.Model):
    user_id = db.Column(db.Integer, db.ForeignKey("user.id"), primary_key=True)
    course_id = db.Column(db.Integer,
                          db.ForeignKey("course.id"),
                          primary_key=True)