We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c836f59 commit 8e90616Copy full SHA for 8e90616
DjangoEcommerceApp/filters.py
@@ -0,0 +1,23 @@
1
+import django_filters
2
+from DjangoEcommerceApp.models import Products, SubCategories
3
+
4
+class ProductFilter(django_filters.FilterSet):
5
+ subcategories_id=django_filters.ModelChoiceFilter(
6
+ queryset=SubCategories.objects.all(),
7
+ label='Subcategory'
8
+ )
9
10
+ search=django_filters.CharFilter(
11
+ field_name='product_name',
12
+ lookup_expr='icontains',
13
+ label='Search Product'
14
15
16
+ class Meta:
17
+ model = Products
18
+ fields = {
19
+ 'subcategories_id':['exact'],
20
+ 'brand':['icontains'],
21
+ 'product_max_price':['lte', 'gte'],
22
+ 'product_discount_price':['lte', 'gte'],
23
+ }
0 commit comments