Jordan Walsh
Jordan Walsh

Reputation: 1625

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()

Implementation:

s = Session()
s.refreshSession()

Is this recommended?

Upvotes: 2

Views: 231

Answers (1)

Ned Batchelder
Ned Batchelder

Reputation: 375484

This is the typical way to add behavior to model objects. Why wouldn't you do it this way?

Upvotes: 2

Related Questions