Commit 18f3abd653ba7dbb6efecce94422ec2e7ad7a0e5
1 parent
bf0df5af
Exists in
master
and in
1 other branch
- fixed __repr__() functions in models.py
Showing
1 changed file
with
13 additions
and
4 deletions
Show diff stats
models.py
@@ -24,6 +24,13 @@ class StudentTopic(Base): | @@ -24,6 +24,13 @@ class StudentTopic(Base): | ||
24 | student = relationship('Student', back_populates='topics') | 24 | student = relationship('Student', back_populates='topics') |
25 | topic = relationship('Topic', back_populates='students') | 25 | topic = relationship('Topic', back_populates='students') |
26 | 26 | ||
27 | + def __repr__(self): | ||
28 | + return f'''StudentTopic: | ||
29 | + student_id: "{self.student_id}" | ||
30 | + topic_id: "{self.topic_id}" | ||
31 | + level: "{self.level}" | ||
32 | + date: "{self.date}"''' | ||
33 | + | ||
27 | # --------------------------------------------------------------------------- | 34 | # --------------------------------------------------------------------------- |
28 | # Registered students | 35 | # Registered students |
29 | # --------------------------------------------------------------------------- | 36 | # --------------------------------------------------------------------------- |
@@ -61,13 +68,14 @@ class Answer(Base): | @@ -61,13 +68,14 @@ class Answer(Base): | ||
61 | topic = relationship('Topic', back_populates='answers') | 68 | topic = relationship('Topic', back_populates='answers') |
62 | 69 | ||
63 | def __repr__(self): | 70 | def __repr__(self): |
64 | - return '''Question: | 71 | + return f'''Question: |
65 | id: "{self.id}" | 72 | id: "{self.id}" |
66 | ref: "{self.ref}" | 73 | ref: "{self.ref}" |
67 | grade: "{self.grade}" | 74 | grade: "{self.grade}" |
68 | starttime: "{self.starttime}" | 75 | starttime: "{self.starttime}" |
69 | finishtime: "{self.finishtime}" | 76 | finishtime: "{self.finishtime}" |
70 | - student_id: "{self.student_id}"''' | 77 | + student_id: "{self.student_id}" |
78 | + topic_id: "{self.topic_id}"''' | ||
71 | 79 | ||
72 | # --------------------------------------------------------------------------- | 80 | # --------------------------------------------------------------------------- |
73 | # Table with student state | 81 | # Table with student state |
@@ -80,5 +88,6 @@ class Topic(Base): | @@ -80,5 +88,6 @@ class Topic(Base): | ||
80 | students = relationship('StudentTopic', back_populates='topic') | 88 | students = relationship('StudentTopic', back_populates='topic') |
81 | answers = relationship('Answer', back_populates='topic') | 89 | answers = relationship('Answer', back_populates='topic') |
82 | 90 | ||
83 | - # def __init__(self, id): | ||
84 | - # self.id = id | 91 | + def __repr__(self): |
92 | + return f'''Topic: | ||
93 | + id: "{self.id}"''' |