Should not be default=auth.user but default=auth.user_id (same for update=...) Anyway you will get Null when user_id is None.
On Friday, 13 December 2013 12:23:49 UTC-6, TSmith wrote: > > There exists a table. I added the modified_by field as shown below. I > also tried the second version which is what I really want. > > db.define_table('DOCUMENTATION', > Field('documentation_type','string'), > Field('modified_by', 'reference auth_user', > default=auth.user_id, update=auth.user_id, writable=False)) > > db.define_table('DOCUMENTATION', > Field('documentation_type','string'), > Field('modified_by', 'string', > default=auth.user, update=auth.user, writable=False)) > > I then modify (via SQLForm) a row in the table. checking the database > with SQL I can see that the modified_by column is added to the table. But > the row that I modified is null. > > Why: I know auth has record versioning, but I have multiple application > that use the database. I use triggers to audit changes to key reference > tables. In these triggers I see "web2py" in the application field (nice > for setting that). I'd like to have the modified_by field update with each > change to make it easier to see who did what. > > -- end of question > New to the software. Liking it very much. thanks to all those who > contribute. > > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.