Skip to content

The Problems model defines 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

Description

@happylittle7

The Problems model defines 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.


Originally posted by @Copilot in #156 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions