Commit 18f3abd653ba7dbb6efecce94422ec2e7ad7a0e5

Authored by Miguel Barão
1 parent bf0df5af
Exists in master and in 1 other branch dev

- 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 24 student = relationship('Student', back_populates='topics')
25 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 35 # Registered students
29 36 # ---------------------------------------------------------------------------
... ... @@ -61,13 +68,14 @@ class Answer(Base):
61 68 topic = relationship('Topic', back_populates='answers')
62 69  
63 70 def __repr__(self):
64   - return '''Question:
  71 + return f'''Question:
65 72 id: "{self.id}"
66 73 ref: "{self.ref}"
67 74 grade: "{self.grade}"
68 75 starttime: "{self.starttime}"
69 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 81 # Table with student state
... ... @@ -80,5 +88,6 @@ class Topic(Base):
80 88 students = relationship('StudentTopic', back_populates='topic')
81 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}"'''
... ...