【发布时间】:2021-09-10 23:46:06
【问题描述】:
我有:
class Direction(models.Model):
left = models.OneToOneField(
'self', on_delete=models.SET_NULL, null=True, related_name='right')
right = models.OneToOneField(
'self', on_delete=models.SET_NULL, null=True, related_name='left')
错误:
ant.Direction.left:(fields.E302)“ant.Direction.left”的反向访问器与字段名称“ant.Direction.right”冲突。 提示:重命名字段“ant.Direction.right”,或在字段“ant.Direction.left”的定义中添加/更改相关名称参数。
如何建立这种关系以便a.left = b 和b.right = a?
【问题讨论】:
标签: django django-models