Improved XML format check
This commit is contained in:
parent
f95c010cad
commit
01e33bd2df
@ -21,11 +21,12 @@ def model_form_upload(request):
|
||||
return HttpResponse('Niepoprawny format XML', status=406)
|
||||
|
||||
form = DocumentForm(request.POST, request.FILES)
|
||||
print("POST: " + str(request.POST))
|
||||
print("FILES: " + str(request.FILES))
|
||||
try:
|
||||
data = parseData(request.FILES['file'])
|
||||
except:
|
||||
return HttpResponse('Niepoprawny format XML', status=406)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
data = parseData(request.FILES['file'])
|
||||
return JsonResponse(data, safe=False)
|
||||
else:
|
||||
form = DocumentForm()
|
||||
|
Loading…
Reference in New Issue
Block a user