Thanks, Bernhard.
The solution I ended up with is quite messy, but it does work:
# Set defaults
if request.get_vars:
filter_bar.vars.from_date = datetime.datetime.strptime(
request.get_vars.from_date, "%Y-%m-%d").date()
filter_bar.vars.to_date = datetime.datetime.strptime(
request.get_vars.to_date, "%Y-%m-%d").date()
else:
filter_bar.vars.from_date = last_day_last_month.replace(day=1)
filter_bar.vars.to_date = last_day_last_month
# Submit form
if filter_bar.validate(keepvalues=True):
if filter_bar.vars.daterange:
daterange = int(filter_bar.vars.daterange)
if daterange > 0:
from_date, to_date = get_daterange_dates(daterange)
redirect(URL(vars=dict(from_date=from_date,
to_date=to_date)))
>
--
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.