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 from book and from sqlhtml.py)...

Anyway, it works now...

:)

Richard

On Fri, Mar 6, 2015 at 3:11 PM, Niphlod <[email protected]> wrote:

> 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 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))
>>>         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 normalized... Many fields are just showed (not
>>> writeable) and the user check a box to review them... These records are
>>> missing, but they are not all required for the compute to work.
>>>
>>> Should my compute have to be in the form.vars to compute?
>>>
>>> Should I explicitly have to redifined it or append it like so :
>>>
>>> form.vars[mycompute] = db.table.mycompute.compute
>>>
>>> ?
>>>
>>> Richard
>>>
>>> On Thu, Mar 5, 2015 at 5:14 PM, Anthony <[email protected]> wrote:
>>>
>>>> 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 !=
>>>>> db[request.args(0)].record_review_status:
>>>>>                 form.vars[f] = form.vars.get(f,
>>>>> db[request.args(0)](request.args(1))[f])
>>>>>
>>>>
>>>> If it is an update form, all the fields should be in the form already
>>>> (unless they were explicitly excluded from the form). Also, the above does
>>>> a separate database select for every missing field -- it would be better to
>>>> fetch the record just once and then read the fetched record.
>>>>
>>>> Anthony
>>>>
>>>> --
>>>> 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.
>>>>
>>>
>>>  --
> 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.
>

-- 
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.

Reply via email to