ToscaWidgets CalendarDatePicker pylons
How does one set the date on the CalendarDatePicker. i.e. it defaults to current date and I want to display it with another date which I will set from my controller.
I am displaying the CalendarDatePicker widget in a TableForm from tw.form. I have looked at this for a few hours and can't work out how to do this so any pointers greatly appreciated.
impo开发者_如何学编程rt tw.forms as twf
form = twf.TableForm('dateSel', action='changeDate', children=[
twf.CalendarDatePicker('StartDate', date_format = "%d/%m/%Y"),
twf.CalendarDatePicker('EndDate', date_format = "%d/%m/%Y" )
])
I don't have a copy of twforms laying around, but based on their sample code, it looks like you might want to do something like:
from datetime import datetime
start = twf.CalendarDatePicker('StartDate', date_format = "%d/%m/%Y")
start.default = datetime.now() # or any valid datetime object
end = twf.CalendarDatePicker('EndDate', date_format = "%d/%m/%Y" )
start.default = datetime.now() # or any valid datetime object
form = twf.TableForm('dateSel', action='changeDate', children=[start, end])
精彩评论