Auth.signature not updating update_on

63 views
Skip to first unread message

António Ramos

unread,
Jun 26, 2017, 1:21:43 PM6/26/17
to web...@googlegroups.com
Hi,

my table 
db.define_table(
    'entities',
    Field('uuid',length=64,default=lambda:str(uuid.uuid4())),
    Field('entity',required=True,label=T("Entity")),
    Field('description',label=T("Description"),default=""),
    Field('status', db.status),
    Field('type','reference dbentities',label=T("Type")),
    # Field('workflow','reference workflows',label="Workflow"),
    Field('event'),
    Field("last_error",default=""),
    Field('readers','list:string',default=[""]),
    auth.signature,
     format='%(entity)s',
)
the field update_on is not being updated  when i update a record via code.

if i update a record via appadmin it does also not update update_on field

Help :)

thank you

Anthony

unread,
Jun 26, 2017, 2:48:39 PM6/26/17
to web2py-users
auth.signature includes a modified_on field, not an update_on field.

Also, if you update a record by making changes to the row object and then calling row.update_record() (with no arguments), it will update the record with all the existing values (so modified_on will not be changed).

Anthony

António Ramos

unread,
Jun 27, 2017, 5:02:04 AM6/27/17
to web...@googlegroups.com
Yes anthony i meant modified_on ,not update_on

I have this code

table[id]=dict(field1=1,field2=2)

the row is updated but the modified_on is not.


Regards


--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anthony

unread,
Jun 27, 2017, 11:40:27 AM6/27/17
to web2py-users
We probably need to see more code and an exact description of the workflow to make the update and check whether it was applied.

Anthony

António Ramos

unread,
Jul 21, 2017, 12:24:28 PM7/21/17
to web...@googlegroups.com
For this simple test

db.define_table('tab1',
Field('name'),
auth.signature    
)

i got to admin and create a record
Initially the record is saved with modified_on as 2017-07-21 16:21:36

then via admin i edit the record and change name field and save.

The modified_on is still with 2017-07-21 16:21:36

Is this normal?

Regards

Anthony

unread,
Jul 21, 2017, 5:19:47 PM7/21/17
to web2py-users
In appadmin, I think all fields are made writable, which means the modified_on field should appear in the form - is that what you see? If so, the old value will simply be submitted with the form, so the value will not be updated (unless you manually change it).

The automatic update will only happen if no value is submitted with the form (i.e., the field is not included in the form).

Anthony

António Ramos

unread,
Jul 21, 2017, 5:50:26 PM7/21/17
to web...@googlegroups.com
Great and simple.
Thank you Anthony

Reply all
Reply to author
Forward
0 new messages