def uploadfile(request): manipulator = HomeworkUpload.AddManipulator() if request.POST: # New upload if data was POSTed. new_data = request.POST.copy() new_data = request.FILES groupadd = request.POST['togroup'] errors = manipulator.get_validation_errors(new_data) if not errors: # No errors found. manipulator.do_html2python(new_data) manipulator.do_html2python(groupadd) hwkfile = manipulator.save(new_data, groupadd) #ogroup = manipulator.save(groupadd) # toclass = "English" print("No errors") # togroup = 'A1' # toclass_id = 'k' return HttpResponseRedirect("/hwk") else: print(errors) errors = new_data = {} return HttpResponse("File uploaded") print(errors)