Skip to content

Instantly share code, notes, and snippets.

@gijs
Created May 29, 2011 09:54
Show Gist options
  • Save gijs/997618 to your computer and use it in GitHub Desktop.
Save gijs/997618 to your computer and use it in GitHub Desktop.
Neo4j graph model with Django
from neo4j.model import django_model as models
class Movie(models.NodeModel):
title = models.Property(indexed=True)
year = models.Property()
href = property(lambda self: ('movie/%s/' % (self.node.id,)))
def __unicode__(self):
return self.title
class Actor(models.NodeModel):
name = models.Property(index=True)
href = property(lambda self: ('/actor/%s/' %
(self.node.id,)))
def __unicode__(self):
return self.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment