You can try the extra() method and write some SQL:
http://docs.djangoproject.com/en/dev/ref/models/querysets/#extra-select-none-where-none-params-none-tables-none-order-by-none-select-params-none
Something like (you'd need the correct functions for adding time and
finding the current date for
On Apr 30, 11:26 am, Derek wrote:
> I would like to be able to filter a query set based on a calculated date
> value. Googling did not bring up anything obvious.
>
> As close as I can express it in "pseudo syntax", I'd like to do something
> along these lines:
>
> import
On Fri, Apr 30, 2010 at 6:26 AM, Derek wrote:
> MyModel.objects.filter( (my_date_field + relativedelta(months =
> +my_month_field))__lt = today )
wouldnt that be the same as my_date_field__gt=(today -
relativedelta(months=my_month_field))
my_date_field + my_month_field <
I would like to be able to filter a query set based on a calculated date
value. Googling did not bring up anything obvious.
As close as I can express it in "pseudo syntax", I'd like to do something
along these lines:
import datetime
from dateutil.relativedelta import *
today = datetime.now()
4 matches
Mail list logo