D:\zjm_code\basic_project>python manage.py syncdb Error: One or more models did not validate: topics.topic: Accessor for field 'content_type' clashes with related field 'Cont entType.topic_set'. Add a related_name argument to the definition for 'content_t ype'. topics.topic: Accessor for field 'creator' clashes with related field 'User.crea ted_topics'. Add a related_name argument to the definition for 'creator'. topics.topic: Reverse query name for field 'creator' clashes with related field 'User.created_topics'. Add a related_name argument to the definition for 'creato r'. topicsMap.topic: Accessor for field 'content_type' clashes with related field 'C ontentType.topic_set'. Add a related_name argument to the definition for 'conten t_type'. topicsMap.topic: Accessor for field 'creator' clashes with related field 'User.c reated_topics'. Add a related_name argument to the definition for 'creator'. topicsMap.topic: Reverse query name for field 'creator' clashes with related fie ld 'User.created_topics'. Add a related_name argument to the definition for 'cre ator'.
你有许多django无法为其生成唯一名称的外键。
你可以通过在模型中的外键字段定义中添加“ related_name”参数来提供帮助。例如:
content_type = ForeignKey(Topic, related_name='topic_content_type')