Created
February 29, 2012 19:30
-
-
Save mhluongo/1943810 to your computer and use it in GitHub Desktop.
An example neo4django Person model with connections() based on rest traversals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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