I needed to add some sort of date ranging filter into my query. To do that, we first calculate the date range.
1.
import
datetime
2.
3.
six_months_ago
=
(datetime.date.today()
-
datetime.timedelta(
6
*
365
/
12
))
This simply figures out the date which was 6 months from today.
To use that to filter a date field (without time information):
1.
SomeModel.objects.filter(create_date__gte
=
six_months_ago.isoformat())
[ Source ]