我不知道为什么会收到这样的警告;很可能我并不完全理解related_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
我认为在具有相同related_name的关系之间既不共享关系类型,也不共享目标模型。
使用Django 1.4,来自git的neo4django电流。
有什么想法吗?
发布于 2013-05-28 00:41:30
绝对是有冲突的
spouses = models.Relationship('Person',rel_type='SPOUSE',related_name='families')和
children = models.Relationship('Person',rel_type='CHILD',related_name='families')设置related_name表示希望通过该名称访问关系另一端的模型实例。因为这两行都指向Person,所以每个Person实例都需要知道families relationship字段是否引用了“配偶”或“子女”类型的rels。
不过,我不确定证据的警告。如果模特像你期望的那样工作,我就不会担心了。
https://stackoverflow.com/questions/16778888
复制相似问题