Skip to content

Instantly share code, notes, and snippets.

@szabi
Last active December 17, 2015 19:09
Show Gist options
  • Save szabi/e57f23d76b885d604a36 to your computer and use it in GitHub Desktop.
Save szabi/e57f23d76b885d604a36 to your computer and use it in GitHub Desktop.
neo4django warning: expected behaviour?
from neo4django.db import models
class Person(models.NodeModel):
name = models.StringProperty()
born = models.DateTimeProperty()
died = models.DateTimeProperty()
sex = models.StringProperty()
friends = models.Relationship('self',rel_type='friends_with')
#--------
class Evidence(models.NodeModel):
id = models.IntegerProperty()
name = models.StringProperty()
as_of = models.DateTimeProperty()
families = models.Relationship('Family',rel_type='FAMILY',related_name='evidence')
persons = models.Relationship('Person',rel_type='PERSON',related_name='evidence')
next = models.Relationship('Evidence',rel_type='NEXT',related_name='prev')
class Family(models.NodeModel):
status = models.StringProperty() # married, etc.
spouses = models.Relationship('Person',rel_type='SPOUSE',related_name='families')
children = models.Relationship('Person',rel_type='CHILD',related_name='families')
@szabi
Copy link
Author

szabi commented May 27, 2013

I'm not sure why I get this warning; it might well be that I do not completely comprehend the related_name concept, but I thought having different rel_types would make the above model not ambiguous/conflicting...

I get the following warnings in 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))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment