Corrections sur commit précédent

This commit is contained in:
Aurélien Delobelle 2016-08-08 00:24:46 +02:00
parent e978209ebc
commit e55d45b559

View file

@ -9,6 +9,7 @@ from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.auth.models import User, Permission
from django.http import HttpResponse, JsonResponse, Http404
from django.forms import modelformset_factory
from django.db import IntegrityError, transaction
from gestioncof.models import CofProfile, Clipper
from kfet.models import Account, Checkout, Article, Settings
from kfet.forms import *
@ -453,7 +454,7 @@ def kpsul_perform_operations(request):
# Apply all saves in a transaction to ensure database integrity
try:
with transaction.atomic:
with transaction.atomic():
# Saving operation group
operationgroup.save()
data['operationgroup'] = operationgroup.pk
@ -463,5 +464,7 @@ def kpsul_perform_operations(request):
operation.group = operationgroup
operation.save()
data['operations'].append(operation.pk)
except IntegrityError:
data['errors'].append('DB error')
return JsonResponse(data)