Skip to content

Instantly share code, notes, and snippets.

@mhluongo
Created February 29, 2012 19:30
Show Gist options
  • Save mhluongo/1943810 to your computer and use it in GitHub Desktop.
Save mhluongo/1943810 to your computer and use it in GitHub Desktop.
An example neo4django Person model with connections() based on rest traversals
class Person(models.NodeModel):
name = models.StringProperty()
knows = models.Relationship('Person',
rel_type = neo4django.Outgoing.KNOWS,
related_name = 'is_known')
def connections(self, depth=1):
return [Person._neo4j_instance(node) \
for node in self.node.traverse(types=[client.All.KNOWS], stop=depth)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment