document new function
This commit is contained in:
parent
7313f7cf73
commit
195c5265e4
|
@ -36,8 +36,11 @@ class Thing(db.Model):
|
||||||
self.created = kwargs.get('created', datetime.now(timezone.utc))
|
self.created = kwargs.get('created', datetime.now(timezone.utc))
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
def on_update_time(mapper, connection, thing_obj):
|
def on_update_time(mapper, connection, thing_obj):
|
||||||
|
""" This function update the stamptime of field updated """
|
||||||
thing_obj.updated = datetime.now()
|
thing_obj.updated = datetime.now()
|
||||||
|
|
||||||
def update_timestamp(thing_obj):
|
def update_timestamp(thing_obj):
|
||||||
|
""" This function launch a event than listen like a signal when some object is saved """
|
||||||
event.listen(thing_obj, 'before_update', on_update_time)
|
event.listen(thing_obj, 'before_update', on_update_time)
|
||||||
|
|
Reference in New Issue