rows = db((tCls.starting_date<=today) & (tCls.ending_date>=today)).select()
The syntax is always field<=value, never value>=field.
On Tuesday, 16 July 2013 11:16:07 UTC-5, lucas wrote:
>
> can't i limit a query based on a between date thingy like below?
>
> today = datetime.date.today()
> tCls = db.classes
> rows = db((tCls.starting_date<=today) &
> (today<=tCls.ending_date)).select()
>
> i also tried
>
> today = datetime.datetime.today()
>
> where the fields are defined as:
>
> Field('starting_date', 'date', comment='When the class first opens,
> format YYYY-MM-DD', requires=NE,
> default=datetime.date.today()+datetime.timedelta(weeks=1)),
> Field('ending_date', 'date', comment='The difference between the
> starting and ending dates will form the span for rolling enrollment, format
> YYYY-MM-DD', requires=NE,
> default=datetime.date.today()+datetime.timedelta(weeks=17)),
>
> any ideas? lucas
> but i get the error:
>
> TypeError: can't compare datetime.date to Field
>
>
> any ideas? lucas
>
--
---
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/groups/opt_out.