Skip to content

Instantly share code, notes, and snippets.

@otger
Created September 19, 2013 22:38
Show Gist options
  • Save otger/6630838 to your computer and use it in GitHub Desktop.
Save otger/6630838 to your computer and use it in GitHub Desktop.
NDB StructuredProperty example
class ProviderNDB(ndb.Model):
name = ndb.StringProperty() ##Published name
enabled = ndb.BooleanProperty(default = True)
last_crawl = ndb.DateTimeProperty(auto_now_add=True)
p = ProviderNDB(id='test', name='provider test')
p.put()
class testNDB(ndb.Model):
provider = ndb.StructuredProperty(ProviderNDB)
town = ndb.StringProperty()
t = testNDB(id='test', provider = p, town='whatever')
t.put()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment