fix: implement __repr__ method in order to avoid maximum recursion error

This commit is contained in:
andrey-canon
2025-06-03 15:41:18 -05:00
committed by David Ormsbee
parent 9bf923784f
commit a7a7a5b6f0

View File

@@ -287,6 +287,16 @@ class StudentModuleHistory(BaseStudentModuleHistory):
student_module = models.ForeignKey(StudentModule, db_index=True, db_constraint=False, on_delete=models.CASCADE)
def __repr__(self):
student_dict = {
"course_id": str(self.student_module.course_id),
"module_type": self.student_module.module_type,
"student_id": self.student_module.student_id,
"grade": self.grade,
}
return f"StudentModuleHistory<{student_dict!r}>"
def __str__(self):
return str(repr(self))