[Fixed]-Exclude date via .exclude

1👍

Maybe try filtering a date range instead of excluding before and after

Item.objects.filter(date__range=["2017-01-01", "2017-01-31"])

To exclude before and after something like this should work with __lt for less than and __gt for greater than:

Item.objects.exclude(date__lt=datetime.date(2017, 1, 1)).exclude(date__gt=datetime.date(2017, 1, 31))

Leave a comment