Finally, I figured out!!
My compute need the record id, so I shouldn't do this :
if f != db[request.args(0)]._id
To filter out the record id from the update... I have been miss leading by
some example, but I can't recall where they were from, I just search bit
and can't retrieve any (neither
No, the compute field should not be in the form/form.vars. Hard to say what
the problem is. Maybe create a minimal app that reproduces the problem.
Anthony
On Friday, March 6, 2015 at 8:58:23 AM UTC-5, Richard wrote:
Yah right!
row = db[request.args(0)](request.args(1))
Yah right!
row = db[request.args(0)](request.args(1))
for f in db[request.args(0)].fields:
if f != db[request.args(0)]._id and f !=
db[request.args(0)].record_review_status:
form.vars[f] = form.vars.get(f, row[f])
My table is kind of not
IMHO the hiccup comes from the fact that fields that are writable = False
are not rendered as an input/select/whatever, but they're just a TD cell
filled with data. Of course the form isn't submitting it.
On Friday, March 6, 2015 at 4:19:35 PM UTC+1, Anthony wrote:
No, the compute field
web2py doesn't know if a field has been edited or not. form.vars (for a
standard web2py form) holds EVERY value, irregardless of the ones touched
or not by the user...
On Thursday, March 5, 2015 at 4:17:26 PM UTC+1, Richard wrote:
Futher check make me confirm which I thought :
**{f: v for
Yes I struggle with it to make compute works...
I come up with something like this :
after .accepted
for f in db[request.args(0)].fields:
if f != db[request.args(0)]._id and f !=
db[request.args(0)].record_review_status:
form.vars[f] = form.vars.get(f,
On Thursday, March 5, 2015 at 4:18:06 PM UTC-5, Richard wrote:
Yes I struggle with it to make compute works...
I come up with something like this :
after .accepted
for f in db[request.args(0)].fields:
if f != db[request.args(0)]._id and f !=
Futher check make me confirm which I thought :
**{f: v for f, v in form.vars.iteritems()}
Prevent my compute to work since it return only the fields modify by the
user... I need to understand how web2py really update on form submit and
why compute works in this case...
Or how can I make sure
Hello,
I need to do control record update in order to clear some fields values in
case a flag is set to false. But doing the update like this :
db(db[request.args(0)].id == request.args(1)).update(**{f: v for f, v in
form.vars.iteritems()})
prevent a compute field to be trigger and updating
Does form.vars include all the variables needed by the compute function?
Also, instead of:
**{f: v for f, v in form.vars.iteritems()}
you can do:
**db[request.args(0)]._filter_fields(form.vars)
_filter_fields will filter out the id field as well as any form.vars that
are not fields in the
Thanks for answering Anthony,
Actually f1 and f2 belongs to the table, I am filtering them because I want
to treat them separately...
About your question, I am investigating why my compute didn't work... My
first impression is that it is not include in form.vars so it not get hit
at all... But I
The update should calculate the computed field as long as all the values
needed for the calculation are included with the update.
Anthony
On Wednesday, March 4, 2015 at 4:55:01 PM UTC-5, Richard wrote:
Thanks for answering Anthony,
Actually f1 and f2 belongs to the table, I am filtering
12 matches
Mail list logo