On 09/30/2010 03:18 PM, Manu wrote:
Let me be more acurate , this is a stripped down version of my app:

in my model i have defined the test table,

db.define_table('test',
  Field('message'),
  Field('saved_on','datetime', default = datetime.now()),
)

if if my action i have something like

def create():
   form = crud.create('test')
   return dict(form=form)

and in my create view

{{=form}}


If I try now to load this view in my browser the form generated will
already contains a datetime field with a default value equals to the
time i have loaded this form . If i wait 5 minutes to fill the form
and then press the submit button then my saved_on field will not
contains the time i have submited the form but the time i have
generated it. Which is not the right timestamp i want to store.

I would like to know what you, or other web2py users , would recommend
me to store the submit time instead of the form creation time in my
DB.

Do not specify a default in the model. Instead let the database handle it.

--
Adrian Klaver
[email protected]

Reply via email to