I am using Django-filter app to construct search on my website. This is the code:
class PropertyFilter(django_filters.FilterSet):
city = django_filters.ModelMultipleChoiceFilter(queryset=City.objects.all(), widget = CheckboxSelectMultiple)
trade_type = django_filters.ModelMultipleChoiceFilter(queryset=Trade.objects.all(), widget = CheckboxSelectMultiple)
class Meta:
model = Property
fields = ['city', 'trade_type']
The problem is that when user marks two cities, Django-filter only filters objects via last URL parameter (city no. 2 in this casse):
http://example.org/lt/list/city=1&city=2
Models.py:
class City(models.Model):
name = models.CharField(max_length=250, verbose_name=_('Name'))
Maybe I am doing something wrong ?
http://example.org/lt/list/?city=1,2