what is the method name that gets executed every time a member of a class is updated?
for example, init is run when an object is instantiated:
class Foo(db.Model)
id = db.Column(db.Integer, primary_key=True)
description = db.Column(db.String(50))
def __init__(self, description):
self.description = description
i would like to add a method to this class that runs every time i update a Foo object.
after reading up on python classes here:
http://www.rafekettler.com/magicmethods.html
i thought that the method i was looking for would look something like the below (but haven't gotten it working yet):
class Foo(db.Model)
id = db.Column(db.Integer, primary_key=True)
description = db.Column(db.String(50))
def __init__(self, description):
self.description = description
def __call__(self, description):
print 'obj is getting updated!'
self.description = description
thanks for the help!