Computed fields are not updated when you update_record. Open a ticket,
perhaps they should.
On Friday, 18 October 2013 17:50:19 UTC-5, Ángel Gabriel Morales Acosta
wrote:
>
> Hi.
>
> I'm using 2.7.4-stable+timestamp.2013.10.16.09.10.20
>
> In db.py :
> db.define_table('table',
> Field('a','double'),
> Field('b','double'),
> Field('c','double', compute=lambda r: r['a']+r['b'])
> )
>
> In appadmin.py:
> add record with values a=1, b=2 that right, produce c=3
>
> But In controller:
> def sum():
>
> sum = db(db.table.id==1).select()
> sum.update_record(a=2)
>
> print sum ## wrong, that no update computed fields, c is still 3 when
> it should be 4
>
> message = 'Hello'
> return dict(message=message)
>
> What is wrong?
> Thanks.
>
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.