user3982654
user3982654

Reputation:

Django filter from date to date

I'm trying to find a way to set a filter on Django Admin for dates using start date and end date, but on the docs the search seems to do a SQL search like so

WHERE (first_name ILIKE 'john' OR last_name ILIKE 'john')
AND (first_name ILIKE 'lennon' OR last_name ILIKE 'lennon')

Upvotes: 1

Views: 260

Answers (1)

Du D.
Du D.

Reputation: 5310

If you are doing date search you can use the range field look up function. https://docs.djangoproject.com/en/1.7/ref/models/querysets/#range

Eg. Employee.objects.filter(bday__range=(start_date, end_date))

Upvotes: 2

Related Questions