aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-03-18 11:46:47 +0200
committerFilipp Lepalaan <filipp@mac.com>2016-03-18 11:46:47 +0200
commit07600c09b7811b7f963d679467111e3cda4ac726 (patch)
treeab3a79624fd3304a0a0a7709df4f15d94740561a
parent65df597329bbb602dd382695c639aab3776123ea (diff)
downloadServo-07600c09b7811b7f963d679467111e3cda4ac726.tar.gz
Servo-07600c09b7811b7f963d679467111e3cda4ac726.tar.bz2
Servo-07600c09b7811b7f963d679467111e3cda4ac726.zip
Handle editing a product that's been removed from order
-rw-r--r--servo/views/order.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/servo/views/order.py b/servo/views/order.py
index e9d5a51..3b3930a 100644
--- a/servo/views/order.py
+++ b/servo/views/order.py
@@ -664,7 +664,12 @@ def edit_product(request, pk, item_id):
Edits a product added to an order
"""
order = Order.objects.get(pk=pk)
- item = ServiceOrderItem.objects.get(pk=item_id)
+
+ try:
+ item = ServiceOrderItem.objects.get(pk=item_id)
+ except ServiceOrderItem.DoesNotExist:
+ messages.error(request, _('Product not found in order'))
+ return redirect(order)
if not item.kbb_sn and item.product.part_type == "REPLACEMENT":
try: