diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-09-10 16:19:54 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-09-10 16:19:54 +0300 |
commit | 5ae2336abc50f6874e5c0df785d3dbe5016d459d (patch) | |
tree | b308194a6a2ed90a8f68cb5a0ba2006fefe706b0 /servo/views | |
parent | 7b6774fba294988693ea227717dc789db898072c (diff) | |
download | Servo-5ae2336abc50f6874e5c0df785d3dbe5016d459d.tar.gz Servo-5ae2336abc50f6874e5c0df785d3dbe5016d459d.tar.bz2 Servo-5ae2336abc50f6874e5c0df785d3dbe5016d459d.zip |
Fix MultipleObjectsReturned exception
We cannot enforce SN uniqueness so let’s just use the first match when
creating order with device SN
Diffstat (limited to 'servo/views')
-rw-r--r-- | servo/views/gsx.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/servo/views/gsx.py b/servo/views/gsx.py index 0269462..908e9f5 100644 --- a/servo/views/gsx.py +++ b/servo/views/gsx.py @@ -75,12 +75,12 @@ def import_repair(request, order_pk, device_pk): form = ImportForm(request.POST) if form.is_valid(): confirmation = form.cleaned_data['confirmation'] - try: repair = Repair.create_from_gsx(confirmation, order, device, request.user) + messages.success(request, _('GSX repair %s imported successfully' % confirmation)) return redirect(repair) except Exception as e: messages.error(request, e) @@ -100,7 +100,7 @@ def return_label(request, repair, part): repair.connect_gsx(request.user) label_data = repair.get_return_label(part) return HttpResponse(label_data, content_type="application/pdf") - except gsxws.GsxError, e: + except gsxws.GsxError as e: messages.error(request, e) return redirect(repair.order) |