Answer the question
In order to leave comments, you need to log in
How to implement multi-parameter search in django-filter?
Implemented filtering by table fields.
The filtering works as it should, but I need that when selecting, say, the first floor, along with the first floor, the table still shows records where the floor still has a mark of any, i.e. you select the first floor in the filter and the records are filtered so that 1- 1st floor and any floor. I don't understand how this can be implemented. Please help me understand
Here is the code from filters.py
class DailyOrdersFilter(django_filters.FilterSet):
STATUS_CHOICES1 = (
('-1', '-1'),
('1', '1'),
('2', '2'),
('3', '3'),
('4', '4'),
('', 'любой'),
)
floor = django_filters.ChoiceFilter(choices=STATUS_CHOICES1, label='Требуемый этаж', lookup_expr='icontains')
class Meta:
model = DailyOrders
fields = ['floor']
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question