aboutsummaryrefslogtreecommitdiffstats
path: root/servo/views/product.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-09-25 20:03:45 +0300
committerFilipp Lepalaan <filipp@mac.com>2015-09-25 20:03:45 +0300
commit304d222168e3a70c216d669e20e158110f2a22ef (patch)
treed7c8a61c41d5fb600c4f1a8e39aa5699daa43539 /servo/views/product.py
parent5607d28f8f1187623b58241efb59193b5a0b868f (diff)
downloadServo-304d222168e3a70c216d669e20e158110f2a22ef.tar.gz
Servo-304d222168e3a70c216d669e20e158110f2a22ef.tar.bz2
Servo-304d222168e3a70c216d669e20e158110f2a22ef.zip
Fixed browsing by location
Diffstat (limited to 'servo/views/product.py')
-rw-r--r--servo/views/product.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/servo/views/product.py b/servo/views/product.py
index 505f028..01f551b 100644
--- a/servo/views/product.py
+++ b/servo/views/product.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import json
from decimal import *
from django.db.models import Q
@@ -66,7 +65,7 @@ def prep_list_view(request, group='all'):
location = fdata.get('location')
if location:
- all_products = all_products.filter(inventory__contains=location.pk)
+ all_products = all_products.filter(inventory__location=location)
else:
form = ProductSearchForm()
@@ -88,9 +87,10 @@ def tags(request):
"""
Returns all product tags
"""
+ from servo.lib.utils import json_response
tags = TaggedItem.objects.filter(content_type__model="product")
tags = tags.distinct("tag").values_list("tag", flat=True)
- return HttpResponse(json.dumps(list(tags)), content_type='application/json')
+ return json_response(list(tags))
def list_products(request, group='all'):
@@ -361,7 +361,7 @@ def view_product(request, pk=None, code=None, group=None):
data['product'] = product
data['inventory'] = inventory
data['title'] = '%s - %s' % (product.code, product.title)
-
+
return render(request, "products/view.html", data)
@@ -451,7 +451,7 @@ def update_price(request, pk):
GsxAccount.default(request.user)
product.update_price()
messages.success(request, _('Price info updated from GSX'))
- except Exception, e:
+ except Exception as e:
messages.error(request, _('Failed to update price from GSX'))
return redirect(product)