예제 #1
0
class PDF(db.Model):
	id = db.Column(db.Integer, primary_key=True, autoincrement=True)
	course_id = db.Column(db.Integer)
	file_name = db.Column(db.String(255), nullable=False)

	def as_dict(self):
		return {c.name: getattr(self, c.name) for c in self.__table__.columns}

	def __repr__(self):
		return '<PDF {}>'.format(self.name)
예제 #2
0
class Take(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    student_id = db.Column(db.Integer)
    course_id = db.Column(db.Integer)

    def as_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}

    def __repr__(self):
        return '<Take {}>'.format(self.name)
예제 #3
0
class Check(db.Model):
	__tablename__ = 'check'
	id = db.Column(db.Integer, primary_key=True, autoincrement=True)
	course_id = db.Column(db.Integer)
	create_time = db.Column(db.Integer, default=1577049460)

	def as_dict(self):
		return {c.name: getattr(self, c.name) for c in self.__table__.columns}

	def __repr__(self):
		return '<Check {}>'.format(self.name)
예제 #4
0
class StudentCheck(db.Model):
    __tablename__ = 'student_check'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    check_id = db.Column(db.Integer)
    student_id = db.Column(db.Integer)
    check_time = db.Column(db.DateTime)
    isvalid = db.Column(db.Boolean)

    def as_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}

    def __repr__(self):
        return '<StudentCheck {}>'.format(self.name)
class Course(db.Model):
	__tablename__ = 'course'
	id = db.Column(db.Integer, primary_key=True, autoincrement=True)
	name = db.Column(db.String(255), nullable=False)
	description = db.Column(db.String(255))
	teacher_id = db.Column(db.Integer)
	image = db.Column(db.String(255))

	def as_dict(self):
		return {c.name: getattr(self, c.name) for c in self.__table__.columns}

	def __repr__(self):
		return '<Course {}>'.format(self.name)
class Teacher(db.Model):
    __tablename__ = 'teacher'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255), nullable=True)
    password = db.Column(db.String(255), nullable=True)
    e_mail = db.Column(db.String(255))
    create_time = db.Column(db.DateTime)

    def as_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}

    def __repr__(self):
        return '<Teacher {}>'.format(self.name)
예제 #7
0
class Student(db.Model):
    __tablename__ = 'student'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    username = db.Column(db.String(255), nullable=False, unique=True)
    password = db.Column(db.String(255), nullable=False)
    e_mail = db.Column(db.String(255))
    create_time = db.Column(db.DateTime)

    def as_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}

    def __repr__(self):
        return '<Student {}>'.format(self.name)
class Category(db.Model):
	__tablename__ = 'category'
	id = db.Column(db.String(255), primary_key=True, autoincrement=True)

	def as_dict(self):
		return {c.name: getattr(self, c.name) for c in self.__table__.columns}

	def __repr__(self):
		return '<Category {}>'.format(self.name)