8👍
After some studies, I’ve found this simple solution
class ProductFilter(django_filters.FilterSet):
class Meta:
model = Product
fields = [ 'shortname', 'fullname', 'description', 'product_type', ]
def __init__(self, *args, **kwargs):
super(ProductFilter, self).__init__(*args, **kwargs)
# at sturtup user doen't push Submit button, and QueryDict (in data) is empty
if self.data == {}:
self.queryset = self.queryset.none()
I think, this solution is stable. How do you think?
👤Y.N
Source:stackexchange.com