Have you tried the 'default' keyword for SQLField? SQLFIELD('add_date', 'datetime', default=<insert your default here>)?
On Sat, Jun 27, 2009 at 9:54 PM, kuba<kubano...@gmail.com> wrote: > > > I will try to explain it better: > > for example one of my tables looks like this > > db.define_table("active_task", > SQLField('parameters', 'string'), > SQLField('add_date', 'datetime'), > SQLField('state', 'integer')) > > What I'm trying to achieve is that every time someone inserts a row - > column add_date should point to actual time of insertion. > > The easiest way for me is default value in database: > > add_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, > > but i can't make such statement with SQLField class ? > > i found there is something like > 'notnull': 'NOT NULL DEFAULT %(default)s', > > in sql.py > but I have no idea how to make use of it > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---