#1192: CalendarDateTimePicker need to accept callables for default values
---------------------+------------------------------------------------------
Reporter: guest | Owner: anonymous
Type: defect | Status: closed
Priority: normal | Milestone: 1.0
Component: Widgets | Version: 1.0b2
Severity: normal | Resolution: wontfix
Keywords: |
---------------------+------------------------------------------------------
Changes (by alberto):
* status: new => closed
* resolution: => wontfix
Comment:
Why dont you make your own picker by subclassing?
{{{
#!py
from tubogears.widgets import CalendarDateTimePicker
from datetime import datetime, timedelta
class DeltaCalendar(CalendarDateTimePicker):
params = ['delta']
delta = timedelta()
def update_params(self,d):
super(MyCalendar, self).update_params(d)
d['value'] = datetime.now() + d['delta']
cal = DeltaCalendar("date", delta=timedelta(weeks=-2))
# Can also change the delta when displaying or pass a callable to
determine it for every request:
cal.diplay(delta=timedelta(weeks=-1))
cal = DeltaCalendar("date", delta=lambda: timedelta(days=2))
}}}
You get the idea...
1.0b2 is in feature freeze so I'll close this as wontfix. Sorry.
Alberto
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/1192>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" 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/turbogears-tickets?hl=en
-~----------~----~----~----~------~----~------~--~---