I dont know if I understand clearly what you want, but..

May be :

def get_sql_date():
   return db.executesql('select CURRENT_DATE')

Field('grade_date','date',compute=get_sql_date,required=True,notnull=True)

or

Field('grade_date','date',default=request.now.date().strftime('%Y-%m-%d'),required=True,notnull=True)




2010/8/27 Adrian Klaver <[email protected]>

> I seem to be having problems getting my head around the default argument to
> Field.
>
> I am using SQLite as the backend.
>
> If I do:
> Field('grade_date','date',default=request.now,required=True,notnull=True)
>
> I get a database column with a DEFAULT of todays date, not what I want:
> grade_date DATE NOT NULL DEFAULT '2010-08-27'
>
> If I do not include the default argument in the initial define_table  but
> add it
> later todays date shows up in the form but there is no DEFAULT added to the
> column.
>
> What I would like to do is pass the SQLite date variable CURRENT_DATE to
> the
> table. At this point I am unclear as to whether default is associated with
> the
> table or the form.
>
> Thanks,
> --
> Adrian Klaver
> [email protected]
>



-- 

http://rochacbruno.com.br

Reply via email to