[web2py] Tracking the date/time of a field change.

2013-10-07 Thread James Thompson
I need to track the date/time of the last change to one field in a row. Example: Field('f_status', type='text', label=T('Status'), requires=IS_IN_SET(['status1', 'status2', 'status3'])), Field('f_status_change_dt', type='datetime', label=T('Status Change Dt')), where 'status_

[web2py] Re: Tracking the date/time of a field change.

2013-10-07 Thread James Thompson
I thought default=request.now and update=request.net reflect changes in the record as a whole? I'm looking for something that only updates when the value of the status field changes. On Monday, October 7, 2013 3:31:33 AM UTC-10, 黄祥 wrote: > > i think you can achieve it with default. > e.g. > F

[web2py] SQLTABLE and foreign key fields

2013-10-09 Thread James Thompson
When using SQLTABLE (or something like: {{=query_results}}) to display rows in a view, foreign key fields display data from their related table. Is web2py doing individual queries for each of these fields? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://githu

[web2py] Re: Tracking the date/time of a field change.

2013-10-09 Thread James Thompson
: > > why don't you use callbacks ? they are the most useful feature in DAL's in > my POV. > > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks > > On Monday, October 7, 2013 8:55:29 PM UTC+2, James Thompson

[web2py] Re: SQLTABLE and foreign key fields

2013-10-10 Thread James Thompson
g.owner.readable = False > SQLFORM.grid(db.dog.represent==db.person.id) > > or cache it: > > db.dog.owner.represent = lambda v,r: cache.ram('person-%s'%v, lambda v=v: > v and '%(name)s'%db.person(v), None) > SQLFORM.grid(db.dog.represent==db.person.id

[web2py] Re: Tracking the date/time of a field change.

2013-10-10 Thread James Thompson
I looked at record versioning, but, if I use something like: db.mytable._before_update then when the _before_update function is called, no changes have been made to the database yet. So to get the old value of the field, it seems like I need to read the current database row that is about to be u

[web2py] Re: SQLTABLE and foreign key fields

2013-10-10 Thread James Thompson
5:37:16 AM UTC-10, Massimo Di Pierro wrote: > > Oops. A typo. I fixed it in the previous message. > > On Wednesday, 9 October 2013 21:41:46 UTC-5, James Thompson wrote: >> >> I'm a little confused by: >> >db.dog.owner.represent = None >> >SQLFORM.grid(db.dog.r

[web2py] using legacy mysql tables

2013-10-11 Thread James Thompson
Wondering about support for legacy Mysql tables in web2py. Read the book section on legacy databases, but keep getting: keyed tables can only reference other keyed tables (for now) My mysql db and web2py models like something like this: CREATE TABLE `car_models` ( `model_id` int(10) unsigne

[web2py] Re: using legacy mysql tables

2013-10-11 Thread James Thompson
arykey=[] to the > table definition in your case it's just a matter of column names more > than one of table structure. > > On Friday, October 11, 2013 12:25:33 PM UTC+2, James Thompson wrote: >> >> Wondering about support for legacy Mysql tables in web2py. Read the

[web2py] Re: using legacy mysql tables

2013-10-12 Thread James Thompson
Thanks! It works now. On Saturday, October 12, 2013 2:13:48 AM UTC-10, Niphlod wrote: > > did you add a format= attribute for the referenced table ? > > > > On Saturday, October 12, 2013 4:28:15 AM UTC+2, James Thompson wrote: >> >> I tried it without the dotted nota