def calibrate_face(request): if request.method == 'POST': form = FaceForm(request.POST, request.FILES) if form.is_valid(): form.save() newform = FaceDataForm(instance=form.instance) return render(request, 'mainapp/calibrate.html', {'face': form.instance, 'image': form.instance.image.url}) else: form = FaceDataForm(request.POST, request.FILES) return HttpResponse("Form is not valid")
def upload_face(request): context = RequestContext(request) if request.method == 'POST': form = FaceForm(request.POST, request.FILES) if form.is_valid(): # file is saved form.save() return render_to_response("calibrate.html", {'form': newform}, context) else: form = FaceForm() return render(request, 'mainapp/index.html')
def calibrate_face(request): if request.method == 'POST': form = FaceForm(request.POST, request.FILES) if form.is_valid(): form.save() newform = FaceDataForm(instance=form.instance) return render(request, 'mainapp/calibrate.html', { 'face': form.instance, 'image': form.instance.image.url }) else: form = FaceDataForm(request.POST, request.FILES) return HttpResponse("Form is not valid")
def get_face(request): """ May not be useful""" if request.method == 'POST': form = FaceForm(request.POST) if form.is_valid(): my_method = form.save() else: form = FaceForm() return HttpResponse("Yay! Success!")