Ok I found the problem. It turns out if I use IS_NOT_EMPTY(), the submitted
time field values get treated like a string rather than a datetime.time
object. Instead I changed requires to IS_TIME to get the intended result.
On Monday, August 29, 2016 at 10:00:21 PM UTC-4, H. Das wrote:
>
> Hello
Example usage for IS_TIME is detailed in the code:
https://github.com/web2py/web2py/blob/a2354addec5a45ea6180528d2b8024588a106743/gluon/validators.py#L2125
Kiran Subbaraman
http://subbaraman.wordpress.com/about/
On Tue, 30-08-2016 11:42 AM, H. Das wrote:
Unfortunately it doesn't look like IS_TIME has a format argument. That is
odd.
from the stacktrace:
Field("start_time", "time", requires=IS_TIME(format="%I:%M")),
TypeError: __init__() got an unexpected keyword argument 'format'
On Tuesday, August 30, 2016 at 1:22:45 AM UTC-4, Dave S wrote:
>
On Monday, August 29, 2016 at 7:00:21 PM UTC-7, H. Das wrote:
>
> Hello everyone,
>
> I defined a simple table with time fields like so:
>
> db.define_table("time_block",
> Field("start_time", "time", requires=IS_NOT_EMPTY()),
> Field("end_time", "time", requires=IS_NOT_EMPTY()),
> )
>
>
4 matches
Mail list logo