我这里做了一个日期区间的筛选,我像再做一个就是只输入年月的话,就可以直接筛选出该月的左右列表,应该怎么做呢
class ConsumeDetailsFilter(FilterSet):
# date = filters.DateFilter(field_name='date')
start_date = filters.DateFilter(field_name='date', lookup_expr='gte', label='Start Date')
end_date = filters.DateFilter(field_name='date', lookup_expr='lte', label='End Date')
category = filters.CharFilter(field_name='category', lookup_expr='icontains')
subcategory = filters.CharFilter(field_name='subcategory', lookup_expr='icontains')
vendor = filters.CharFilter(field_name='vendor', lookup_expr='icontains')
item = filters.CharFilter(field_name='item', lookup_expr='icontains')
class Meta:
model = ConsumeDetails
fields = ['start_date','end_date','category', 'subcategory']