I have a table with 4 records and a datetime field
At the database:
start_date
2018-02-24 00:00
None
2018-01-27 14:17
2018-01-24 00:00
the model is:
db.define_table("bookings"
, Field("start_date", "datetime", widget=date_widget)
, Field("end_date", "datetime", widget=text_widget)
, Field("agency", "reference agencies", widget=text_widget)
, Field("people", "integer", default=0, widget=text_widget)
, Field("rooms", "double", default=0, widget=text_widget)
)
the date_widget:
def date_widget(field, value):
print value, type(value)
return value
On the view i have created a table grid to display the records and i call
the widget to represent the data but
on the server console i get this:
------------------------------
2018-02-24 00:00:00 <type 'str'>
2018-02-24 00:00:00 <type 'str'>
2018-02-24 00:00:00 <type 'datetime.datetime'>
None <type 'NoneType'>
2018-01-27 14:17:45 <type 'datetime.datetime'>
2018-01-24 00:00:00 <type 'datetime.datetime'>
The first row is passed to the widget 3 times, 2 times as a string and a 3d
as a datetime as it should be.
The other 3 rows are passed once as they should. The empty value is not the
problem but the first row passed to the widget multiple times with
different types for no reason.
I have a SQLFORM at the controller but even if i am duplicating the widget
call, i cant find an explanation for the first row being executed 3 times
and the others just once. Why would this happen?
Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
Thanks
--
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/d/optout.