I want to add conditions in my start date, like start date have to be <= today and end date > today
class PartLogFilter(django_filters.FilterSet):
date_range = django_filters.DateFromToRangeFilter(
label='By Date Range',
method='filter_by_range',
widget=RangeWidget(attrs={'class': 'datepicker', 'type': 'date'})
)
class Meta:
model = PartLog
fields = ['date_range']
def filter_by_range(self, queryset, name, value):
start = value.start
end = value.stop
return queryset.filter(transaction_time__gte=start, transaction_time__lte=end)