Commit e0593bda authored by Olga Brani's avatar Olga Brani Committed by Athina Bekakou

admin: Handle action's ValidationError

parent 39afbfee
......@@ -19,7 +19,7 @@ from importlib import import_module
from django.views.generic.simple import direct_to_template
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.exceptions import PermissionDenied, ValidationError
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.core.serializers.json import DjangoJSONEncoder
......@@ -347,6 +347,10 @@ def admin_actions(request):
You have requested an action that cannot apply to a target.
"""
response['error_ids'].append(id)
except ValidationError, e:
status = 400
response['result'] = ', '.join(e.messages)
response['error_ids'].append(id)
except Exception as e:
logging.exception("Uncaught exception")
status = 500
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment