class Administer(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(20), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) password = db.Column(db.String(60), nullable=False) # Ctor of User class def __repr__(self): return f"Administer('{self.username}','{self.email}')"
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(20), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) image_file = db.Column(db.String(20), nullable=False, default='default.jpg') password = db.Column(db.String(60), nullable=False) lecture = db.relationship('Lecture', backref='year', lazy=True) # Ctor of User class def __repr__(self): return f"User('{self.username}','{self.email}','{self.image_file}')"
class Report(db.Model): course_id = db.Column(db.Integer, primary_key=True) course_name = db.Column(db.String(20)) course_date = db.relationship('Date', backref='cd', lazy=True) # Ctor of eReport class def __repr__(self): return f"Report('{self.course_id}','{self.course_name}')"
class StudentsInClassroom(db.Model): student_id = db.Column(db.Integer, primary_key=True) student_name = db.Column(db.String(20)) class_room = db.Column(db.Integer, db.ForeignKey('classroom.class_num')) # Ctor of StudentsInClassroom class def __repr__(self): return f"StudentsInClassroom('{self.student_id}','{self.student_name}')"
class Attendance(db.Model): dateOfLesson = db.Column(db.DateTime, primary_key=True) student_id = db.Column(db.Integer) student_name = db.Column(db.String(20)) percentage_att = db.Column(db.Integer) sum = db.Column(db.DateTime) date_course = db.Column(db.DateTime, db.ForeignKey('date.lesson_date')) # Ctor of Attendance class def __repr__(self): return f"Attendance('{self.student_id}','{self.student_name}')"
class Students(db.Model): id = db.Column(db.Integer, nullable=False, primary_key=True) nameOfStudent = db.Column(db.String(20), unique=False, nullable=False) lectures = db.relationship('Lecture', secondary=assigned, backref=db.backref('students', lazy='dynamic')) # lecture_id = db.Column(db.Integer, db.ForeignKey('lecture.id'), nullable=False) # ctor of Student class def __repr__(self): return f"Students('{self.nameOfStudent}')"
class Lecture(db.Model): id = db.Column(db.Integer, primary_key=True) nameOfLecture = db.Column(db.String(20), unique=True, nullable=False) class_number = db.Column(db.Integer) percentage = db.Column(db.Integer) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) course_att = db.relationship('CourseAttendance', backref='attend', lazy=True) # ctor of Lecture class def __repr__(self): return f"Lecture('{self.nameOfLecture}')"
class CourseAttendance(db.Model): lesson_num = db.Column(db.Integer) student_id = db.Column(db.Integer, primary_key=True) student_name = db.Column(db.String(20)) entry_time = db.Column(db.DateTime) exit_time = db.Column(db.DateTime) sum = db.Column(db.DateTime) # is_active = db.Column(db.Integer, default=0) class_room = db.Column(db.Integer, db.ForeignKey('classroom.class_num')) lecture_id = db.Column(db.Integer, db.ForeignKey('lecture.id')) # Ctor of CourseAttendance class def __repr__(self): return f"CourseAttendance('{self.student_id}','{self.student_name}')"