Closes #143: Error when invalid image upload

This commit is contained in:
adi 2018-11-21 20:18:12 +01:00
parent 8d0a2f1ffb
commit ccd1961ba8
2 changed files with 2 additions and 3 deletions

View file

@ -147,7 +147,7 @@ def xml_has_javascript(data):
from re import search, IGNORECASE, MULTILINE
data = str(data, encoding='UTF-8')
print(data)
# print(data)
# ------------------------------------------------
# Handles JavaScript nodes and stringified nodes.
# ------------------------------------------------

View file

@ -45,11 +45,10 @@ class ImageUploadView(BaseFormView):
and the default response for HTTP requests.
:rtype: django.http.JsonResponse, django.http.HttpResponse
"""
response = super(ImageUploadView, self).form_invalid(form)
if self.request.is_ajax():
return JsonResponse(form.errors, status=400)
response = super(ImageUploadView, self).form_invalid(form)
return response
def form_valid(self, form):