def change_name(row, name):
db(db.person.id == row.person.id).update(name=name)
db.define_table('person',
Field('name'),
Field.Method('change_name', change_name))
row = db.person(1)
row.change_name('Lisandro')
Anthony
On Friday, April 26, 2019 at 12:21:28 PM UTC-4, Lisandro wrote:
>
> I've been working with Virtual Fields for a while, but now I'm wondering,
> how could I write a Virtual Field method that modifies the row itself?
>
> I mean, I would like to do something similar that what the
> .update_record() method does. When you call row.update_record(), the row
> object is updated with the new values.
>
> I've tried returning the row object in the method definition function but
> it doesn't work.
>
> I'm wondering, is it even possible to implement something like that? Any
> comment or suggestion will be much appreciated.
>
> Thanks!
> Warm regards,
> Lisandro.
>
--
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/d/optout.