google-code-export / gaeframework

Automatically exported from code.google.com/p/gaeframework
0 stars 0 forks source link

Add computed property #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Idea
Add automatically computed property.

class BlogPost(db.Model):
  slug = db.StringProperty(value=lambda model: model.name.lower())
  name = db.StringProperty(required=True)

OR

class BlogPost(db.Model):
  name = db.StringProperty(required=True)

  @db.property(db.StringProperty)
  def slug(self):
    return self.name.lower()

Recommendations
Use short forma with "value" argument in property, and full form with dedicated 
method.

See also
http://github.com/Arachnid/aetycoon/

Original issue reported on code.google.com by anton.danilchenko on 13 Mar 2011 at 12:23

GoogleCodeExporter commented 9 years ago
Consider using ndb which is now officially a part of GAE

Original comment by c.kl...@hudora.de on 15 Mar 2012 at 5:47

GoogleCodeExporter commented 9 years ago
Please give me a link to NDB.

Original comment by anton.danilchenko on 16 Mar 2012 at 12:52