Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created August 5, 2011 15:32
Show Gist options
  • Save andrewxhill/1127779 to your computer and use it in GitHub Desktop.
Save andrewxhill/1127779 to your computer and use it in GitHub Desktop.
#you have this
class Note(db.Model):
""" user note on a cell """
cell = db.ReferenceProperty(Cell)
#Instead, do this,
class Note(db.Model):
""" user note on a cell """
#parent = Cell #this is done on creation
cell = db.ReferenceProperty(collection='notes', Cell)
"""
What this will allow is a bit more useful, you can drop the RefProp
entirely if you'd never use it.
"""
#So
Note.parent() #would return the cell like Node.cell would have, but now
Cell.notes #will return all the notes that have been applied to it.
"""Another quick one"""
#create a structure capable for search by just the key for Cells
class Cell(db.Model):
#key = 'z/x/y/year/month/day' #if a cell is unique for each day
#or
#key = 'z/x/y/report_id' #if a cell is unique for each report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment