course_id as a ForeignKey with null=False, blank=False (line 84 in problems/models.py), meaning every problem must be associated with a course. However, the permission check on lines 37-38 checks if problem.course_id is falsy and returns an error message "此題目未關聯到任何課程". This check is redundant since the database constraint ensures a course_id must always exist. This condition will never be True in practice. #157
The Problems model defines
course_idas a ForeignKey withnull=False, blank=False(line 84 in problems/models.py), meaning every problem must be associated with a course. However, the permission check on lines 37-38 checks ifproblem.course_idis falsy and returns an error message "此題目未關聯到任何課程". This check is redundant since the database constraint ensures a course_id must always exist. This condition will never be True in practice.Originally posted by @Copilot in #156 (comment)