我不确定为什么会收到此警告;很可能我没有完全理解 lated_name
概念,但我认为具有不同的 rel_types
将使上述模型不模糊/冲突......
我在 neo4django 中收到以下警告:
>>> from evidences.models import *
/[...]/neo4django/db/models/relationships.py:180: UserWarning: `evidence` and `evidence` share a relationship type and direction. Is this what you meant to do?
% (r.name, name))
/[...]/neo4django/db/models/relationships.py:180: UserWarning: `families` and `families` share a relationship type and direction. Is this what you meant to do?
% (r.name, name))
相关型号可以在这里找到:https://gist.github.com/szabi/e57f23d76b885d604a36
我认为具有相同 lated_name
的关系之间既不关系类型也不共享目标模型。
使用 Django 1.4,neo4django 当前来自 git。
有什么想法吗?
最佳答案
两者之间肯定存在冲突
spouses = models.Relationship('Person',rel_type='SPOUSE',related_name='families')
和
children = models.Relationship('Person',rel_type='CHILD',related_name='families')
设置 lated_name
表示您希望通过该名称访问关系另一端的模型实例。由于这两行都指向 Person
,因此每个 Person 实例都需要以某种方式确定 families
关系字段是否引用类型为“SPOUSE”或“CHILD”的 rel。
不过,我不确定证据警告。如果模型按照您的预期工作,我就不会担心。
关于django-models - neo4django:意外的(?)警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16778888/