Django error message “Add a related_name argument to the definition”

前端 未结 8 1490
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 00:53
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 rel         


        
8条回答
  •  臣服心动
    2020-12-01 01:29

    If your models are inheriting from the same parent model, you should set a unique related_name in the parent's ForeignKey. For example:

    author = models.ForeignKey('accounts.User', related_name='%(app_label)s_%(class)s_related')

    It's better explained in the docs

提交回复
热议问题