class Result(db.Entity): student = Optional('Student') mark = Required(int) datemark = Optional(datetime.datetime) topic = Optional('Topic') def set_mark(self, mark): self.mark = mark def get_mark(self): return self.mark def set_datemark(self, datemark): self.datemark = datemark def get_datemark(self): return self.datemark def set_student(self, student): self.student = student def get_student(self): return self.student def set_topic(self, topic): self.topic = self.topic def get_topic(self): return self.topic def __str__(self): return f'mark: {self.mark}\ndatemark: {self.datemark}\nstudent: {self.student}' \ f'\ntopic: {self.topic}'
class Topic(db.Entity): result = Optional('Result') subtheme = Optional('Subtheme') name_topic = Required(str) def set_name_topic(self, name_topic): self.name_topic = self.name_topic def get_name_topic(self): return self.name_topic def __str__(self): return f'name_topic: {self.name_topic}'
class Subtheme(db.Entity): studying = Optional('Studying') topic = Optional('Topic') def set_studying(self, studying): self.studying = studying def get_studying(self): return self.studying def set_topic(self, topic): self.topic = topic def get_topic(self): return self.topic def __str__(self): return f'topic: {self.topic}'
class Subject(db.Entity): item_name = Required(str) studying = Optional('Studying') teacher = Optional('Teacher') def set_item_name(self, item_name): self.item_name = item_name def get_item_name(self): return self.item_name def set_teacher(self, teacher): self.teacher = teacher def get_teacher(self): return self.teacher def __str__(self): return f'item_name: {self.item_name} teacher: {self.teacher}'
class Syllabus(db.Entity): studying = Optional('Studying') klas = Optional('Klas') start = Required(str) finish = Required(str) def set_start(self, start): self.start = start def get_start(self): return self.start def set_finish(self, finish): self.finish = finish def get_finish(self): return self.finish def __str__(self): return f'Начало: {self.start} Конец: {self.finish}'
class Direction(db.Entity): klas = Optional('Klas') name_direction = Required(str) def set_name_direction(self, name_direction): self.name_direction = name_direction def get_name_direction(self): return self.name_direction def __str__(self): return f'direction: {self.name_direction}'
class Student(Human): result = Optional('Result') date = Required(datetime) def set_date(self, date): self.date = date def get_date(self): return self.date def __str__(self): return f'Фамилия: {self.first_name} Имя: {self.second_name} Отчество: {self.patronymic} ' \ f'Дата рождения: {self.date}'
class Studying(db.Entity): hour = Optional(int) klas = Optional('Klas') syllabus = Optional('Syllabus') subject = Optional('Subject') teacher = Optional('Teacher') subtheme = Optional('Subtheme') sub_theme = [] def get_sub_themes(self): return self.sub_theme def set_house(self, hour): self.hour = hour def get_hour(self): return self.hour def set_klas(self, klas): self.klas = klas def get_klas(self): return self.klas def set_syllabus(self, syllabus): self.syllabus = syllabus def get_syllabus(self): return self.syllabus def set_subject(self, subject): self.subject = subject def get_subject(self): return self.subject def set_teacher(self, teacher): self.teacher = teacher def get_teacher(self): return self.teacher def __str__(self): return f'hour: {self.hour}\nklas: {self.klas}\nsyllabus: {self.syllabus} ' \ f'\nsubject: {self.subject}\nteacher: {self.teacher}\nТемы:{", ".join([str(i) for i in self.sub_theme])}'
class Teacher(Human): subject = Optional('Subject') studying = Optional('Studying') def __str__(self): return f'first_name: {self.first_name} second_name: {self.second_name} patronymic: {self.patronymic}'