Horst,
Model:
T.force('en-de') ## en-de is a language file you'll create below
In the table definition:
SQLField('fieldname', type='date')
... a validator on this field which reads like:
db.tablename.fieldname.requires=IS_NULL_OR(IS_DATE(str(T('%Y-%m-
%d'))))
Languages:
... create a language file e.g. en-de.py and edit the dates:
Original Translation
%Y-%m-%d %d-%m-%Y
%Y-%m-%d %H:%M:%S %d-%m-%Y %H:%M:%S
Click update.
Views:
... to use the date in a view:
{{=db.tablename.fieldname.formatter(tablename.fieldname)}}
If you use form_factory to create a custom form, the code in the
controller should read:
SQLField('fieldname',type='date',requires=IS_DATE(str(T('%Y-%m-
%d'))))
I hope I did not leave anything out, if so, let me know.
Kind regards,
Annet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---