On Tue, Feb 10, 2009 at 9:45 AM, Jason DeFontes <[email protected]> wrote:
>
> Is there a simple way to have a calculated property that automatically
> updates itself any time an entity is saved? For example:
>
> class Article(db.Model):
> body = db.StringProperty()
> word_count = db.IntegerProperty()
You should override the put method:
class Article(db.Model):
body = db.StringProperty()
word_count = db.IntegerProperty()
def put(self):
self.word_count = ComputeWordCount(self.body) # or whatever
return super(Article, self).put()
Dave.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---