Google App Engine - Adding Methods to subclasses of db.model
I would like to know if I can add methods to a subclass of db.model. For example:
class Session(db.model):
sessionId = db.StringProperty()
# More Properties
def refreshSession(self):
#do some work
self.put()
Implementat开发者_高级运维ion:
s = Session()
s.refreshSession()
Is this recommended?
This is the typical way to add behavior to model objects. Why wouldn't you do it this way?
精彩评论