[Fixed]-Django rest framework – filtering against date query parameter

1👍

Replace greater than or equal to(__gte) with less than or equal to(__lte) in the query lookup. As shown below:

queryset = queryset.filter(next_action_date__lte=filter_date)

This will fix the issue.

0👍

There are two operators to do this one is less than or equal to(__lte)

As given below:

 queryset = queryset.filter(next_action_date__lte=filter_date)

Second one is less than (__le),

This will not give the current Filter Condition

 queryset = queryset.filter(next_action_date__lt=filter_date) 

Leave a comment