Hello,

Does anoybody knows how to alter the default value of the datetime widget 
in a blank datetime field?.

I think it sets to the actual time in the timezone of the operating system. 
That's fine almost always, but no when the timezone of the application 
differs from the one of the system.

A workaround is to set a default value for the field (e.g. adding default=
request.utcnow), but i would like to leave the field blank by default to 
enforce some behaviour on the user.

My goal is to have the same initial value of the widget at these two fields:

def tzform():
    import pytz
    tz = pytz.timezone('America/Chicago') # use 
pytz.timezone('Europe/Madrid') if you live in America
    
    form = SQLFORM.factory(
        Field('dt1', 'datetime', requires=IS_DATETIME(timezone=tz)),
        Field('dt2', 'datetime', requires=IS_DATETIME(timezone=tz), default=
request.utcnow,)
    )
    
    return locals()


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to