Skip to content

Commit d5a8287

Browse files
andrey-canonDeimerM
authored andcommitted
fix: implement __repr__ method in order to avoid maximum recursion error
1 parent 3955c5c commit d5a8287

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lms/djangoapps/courseware/models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,16 @@ class Meta:
287287

288288
student_module = models.ForeignKey(StudentModule, db_index=True, db_constraint=False, on_delete=models.CASCADE)
289289

290+
def __repr__(self):
291+
student_dict = {
292+
"course_id": str(self.student_module.course_id),
293+
"module_type": self.student_module.module_type,
294+
"student_id": self.student_module.student_id,
295+
"grade": self.grade,
296+
}
297+
298+
return f"StudentModuleHistory<{student_dict!r}>"
299+
290300
def __str__(self):
291301
return str(repr(self))
292302

0 commit comments

Comments
 (0)