[Answer]-Search query result in django

1👍

You first need to make that field of the date a DateField instead of CharField

This is how to query date range in django

News.objects.filter(pub_date__lte=datetime(2014, 5, 30), pub_date__gte=datetime(2014, 1, 30))

Another example would be

News.objects.filter(pub_date__lte=datetime(2014, 5, 30), pub_date__gte=datetime(2014, 1, 30)).exclude(datetime.date.today())

for more information on django queries check out the docs @ Making queries in Django

👤bhappy

Leave a comment