Yes, can see the value of having some statement executed right before the actual insert (or update). Massimo, would it be possible wit the new DAL to provide some hooks into the table that can do some pre insert, update etc stuff? (or provide a way to specify a new table instance where we can do speciifc stuff).
This way we can add some common meta data to a table like inserted/modified stamps and/or logging to a differen table for specials cases without having to rely on the backend or having to build it into other logic. On Sat, Jun 27, 2009 at 10:58 PM, mdipierro<[email protected]> wrote: > > You can do it with a trick but I cannot promise it will work with the > new DAL > > from gluon.sql import SQLXorable > db.define_table(.... > SQLFIELD('add_date', 'datetime', default=SQLXorable("any SQL code > here")) > ) > > Anyway, I think it works but I am not 100% sure. > > Massimo > > On Jun 27, 3:24 pm, kuba <[email protected]> wrote: >> On 27 Cze, 22:09, Hans Donner <[email protected]> wrote: >> >> > Have you tried the 'default' keyword for SQLField? >> >> > SQLFIELD('add_date', 'datetime', default=<insert your default here>)? >> >> yes, I thought also about it. >> >> The problem is that it accepts datetime type (or what ever it is) not >> string >> >> i can only pass request.now to it - and if use crud.create.create() >> with such table it automaticly initialize the field - so if user waits >> some time with button clicking the value is not exacly the time of >> insertion. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

