In most cases, that behavior can be achieved simply by using the "default" and "onupdate" keyword arguments to fields:
def get_current_user(param=None): return "current_user" class Movie(Entity): title = Field(Unicode(30)) year = Field(Integer) created_by = Field(Unicode(30), default=get_current_user) updated_by = Field(Unicode(30), onupdate=get_current_user)
If you need some argument to be passed to the get_current_user function, the following extension might help:
Attachments
- record_owner.py (4.0 kB) - added by ged 4 years ago.
- test_record_owner.py (1.1 kB) - added by ged 4 years ago.
