Hi Gerd,
So if i understand this right there is no possibility to change the
> representation in an update form?
>
Yes, besides, I am not sure whether IS_TIME() has a format property like
IS_DATE() and IS_DATETIME() have.
In 2009 it hadn't, and Chris helped me solve the problem as follows:
In db.py:
istime = dict(type='time',requires=IS_TIME(error_message=T('no match
HH:MM')),widget=timeplain,comment=T('Format HH:MM'))
Field('startTime',**istime),
Field('endTime',**istime),
In a module:
def timeplain(field,value):
if value == None:
value = ''
elif 'strftime' in dir(value):
value = value.strftime('%H:%M')
id = '%s_%s' % (field._tablename, field.name)
return
INPUT(_type='text',_id=id,_class='time_plain',_name=field.name,value=str(value),requires=field.requires)
and in case you need it, in a view:
{{=table.startTime.strftime("%H:%M")}}
Kind regards,
Annet
--
---
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.