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 from re import search, IGNORECASE, MULTILINE
data = str(data, encoding='UTF-8') data = str(data, encoding='UTF-8')
print(data) # print(data)
# ------------------------------------------------ # ------------------------------------------------
# Handles JavaScript nodes and stringified nodes. # Handles JavaScript nodes and stringified nodes.
# ------------------------------------------------ # ------------------------------------------------

View file

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