django-models - neo4django:意外的(?)警告?

标签 django-models neo4j neo4django

我不确定为什么会收到此警告;很可能我没有完全理解 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/

相关文章:

python - 如何在 python 中有效地设置类别模型

python-3.x - 抽象父模型中的 models.E006 - Django 3.1

Neo4j:查询以查找关系最多的节点及其连接的节点

neo4j - 由于缺乏具体化,与 RDF 图相比,属性图的表达能力太弱?

neo4django 管理界面不工作?

python-2.7 - 无法设置neo4jDjango图形数据库: object has no attribute 'db_type'

python - 保护删除 ForeignKey

python - 如何在自定义非管理模型中使用 'set_password'?

neo4j - 如果关系不存在则返回节点

没有Neo4Django的Django和Neo4j