[Answer]-How to filter given two datefields if they coincide with a from and to date in a model django

1👍

That’s a math question. This query should do the trick:

date1 <= to_date and date2 >= from_date

Edit

The following django statement should give you the desired result:

SampleModel.objects.filter(to_date__gte=date1, from_date__lte=date2)

Leave a comment