SystemCheckError

django Exception Published at March 8, 2025, 8:01 a.m. by admin@senrigan.org

SystemCheckErrorでmakemigrationsに失敗する

SystemCheckError: System check identified some issues:

ERRORS:
course.Course.account: (fields.E304) Reverse accessor 'CustomUser.my_courses' for 'course.Course.account' clashes with reverse accessor for 'course.Course.owner'.
    HINT: Add or change a related_name argument to the definition for 'course.Course.account' or 'course.Course.owner'.
course.Course.account: (fields.E305) Reverse query name for 'course.Course.account' clashes with reverse query name for 'course.Course.owner'.
    HINT: Add or change a related_name argument to the definition for 'course.Course.account' or 'course.Course.owner'.
course.Course.owner: (fields.E304) Reverse accessor 'CustomUser.my_courses' for 'course.Course.owner' clashes with reverse accessor for 'course.Course.account'.
    HINT: Add or change a related_name argument to the definition for 'course.Course.owner' or 'course.Course.account'.
course.Course.owner: (fields.E305) Reverse query name for 'course.Course.owner' clashes with reverse query name for 'course.Course.account'.
    HINT: Add or change a related_name argument to the definition for 'course.Course.owner' or 'course.Course.account'.

同じクラス内でrelated_nameダブってた。でもこれ関連する対向のオブジェクトから参照するときに使うんだからダブっても別によさそうに思えるけど、使いどころはそれだけじゃないのか。