To filter query objects by date range in Python Django, we can use the filter method.
For instance, we write
Sample.objects.filter(date__range=["2021-01-01", "2021-01-31"])
to call objects.filter with the date__range parameter set to a list with the date range with the strings as the date values.
date is the column name we’re filtering by.