Ah silly me, I totally overlooked the default functionality. And those 
triggers seem useful. Thanks :-)

On Thursday, April 25, 2013 8:23:24 PM UTC+2, Niphlod wrote:
>
> a computed field gets calculated on update by design..... it's something 
> "dependant" on all other rows values, so if they change, the computed value 
> needs to change also.
> If you want to calculate it only on insert, why don't you just set a 
> default value ?
> If the case is more complicated, I urge you to make good use of 
> "triggers": they're definitely a time saver.
>
> web2py.com/books/default/chapter/29/06#before-and-after-callbacks
>
> On Thursday, April 25, 2013 5:47:30 PM UTC+2, Ivan Šandrk wrote:
>>
>> I'm using a compute field to set uid's for model instances. The problem 
>> is that the compute function gets called on INSERT and on each subsequent 
>> UPDATE operation.
>>
>> I don't want the UPDATE's to change this field - can I somehow detect 
>> where there's an INSERT or an UPDATE in progress? I thought about checking 
>> the field's previous value, but unfortunately compute fields are excluded.
>>
>

-- 

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


Reply via email to