I think what you are looking for is the Field's compute argument.
Check out compute and update arguments for the field constructor,
compared to what the default argument does.

I would get confused by this as well -- web2py does it the best way
and does it consistently, but when getting into I might have expected
default to do some magic based on whether the argument were callable
or not.

So perhaps this should go in the FAQ.

On Aug 27, 9:42 pm, Adrian Klaver <[email protected]> wrote:
> On Friday 27 August 2010 8:27:31 pm mdipierro wrote:
>
> > Try
>
> > db.define_table(.....,Field(...,default=Expression('CURRENT_DATE',db=db)),.
> >...)
>
> > I cannot promise this works but let us know.
>
> No exceptions. What it created was:
>
> CREATE TABLE default_test(
>     id INTEGER PRIMARY KEY AUTOINCREMENT,
>     date_default DATE,
>     txt_fld TEXT
> );
>
> No DEFAULT on the field.
>
> --
> Adrian Klaver
> [email protected]

Reply via email to