aboutsummaryrefslogtreecommitdiffstats
path: root/servo/views
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-09-21 11:07:03 +0300
committerFilipp Lepalaan <filipp@mac.com>2015-09-21 11:07:03 +0300
commit4e7df49fc881793cb34629b8338387db330b1310 (patch)
tree12198a866b9c89fd17d09b46f0e212a3e030e213 /servo/views
parent4a72e3e316861e0d67644ec4102bfb003b28ccb1 (diff)
downloadServo-4e7df49fc881793cb34629b8338387db330b1310.tar.gz
Servo-4e7df49fc881793cb34629b8338387db330b1310.tar.bz2
Servo-4e7df49fc881793cb34629b8338387db330b1310.zip
Added location filter to inventory search
Diffstat (limited to 'servo/views')
-rw-r--r--servo/views/product.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/servo/views/product.py b/servo/views/product.py
index 70f6b63..a614819 100644
--- a/servo/views/product.py
+++ b/servo/views/product.py
@@ -34,6 +34,9 @@ def prep_list_view(request, group='all'):
if group == 'all':
group = ProductCategory(title=_('All'), slug='all')
+ elif group == 'None':
+ group = ProductCategory(title=_('None'), slug='none')
+ all_products = all_products.filter(categories=None)
else:
group = categories.get(slug=group)
all_products = group.get_products()
@@ -60,6 +63,10 @@ def prep_list_view(request, group='all'):
tag = tag.tag
title += u" / %s" % tag
all_products = all_products.filter(tags__tag=tag)
+
+ location = fdata.get('location')
+ if location:
+ all_products = all_products.filter(inventory__contains=location.pk)
else:
form = ProductSearchForm()