carltongibson/django-filter

When i filter with same date it not work i have use gte and lte also

SurajPysquad opened this issue · 1 comments

class ProjectFilter(django_filters.FilterSet):
    search = django_filters.CharFilter(label="Search", method="search_filter", widget=forms.TextInput(attrs={"placeholder": 
     "Search...."}))
    type = django_filters.ChoiceFilter(choices=FILTER_CHOICES, empty_label=None, method="type_filter")
    start_date = django_filters.DateFilter(label='Created Date', field_name='created', lookup_expr='gte')
    end_date = django_filters.DateFilter(label='Created Date To', field_name='created', lookup_expr='lte')

class Meta:
    model = Project
    fields = {
        'created': ['gte', 'lte'],

    }
    
   
   I have data on the same date but when I filter with the same date it does not work 

Would created happend to be a datetime, rather than a date?
Did you see the warning here: https://docs.djangoproject.com/en/5.0/ref/models/querysets/#range

Check the generated SQL to make sure it's what you're expecting.