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

前端 未结 8 1429
伪装坚强ぢ
伪装坚强ぢ 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:27

    Do as the error message instructs you to:

    Add a related_name argument to the definition for 'creator'.

    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题