Beispiel #1
0
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")
Beispiel #2
0
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!")
Beispiel #3
0
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')
Beispiel #4
0
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')
Beispiel #5
0
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!")
Beispiel #6
0
def index(request):
    ctx = {}
    if request.method == 'GET':
        form1 = FaceForm(request.GET)
        ctx['form1'] = form1
        return render(request, 'mainapp/index.html', ctx)

    if request.method == 'POST':
        form = FaceDataForm(request.POST)
        if form.is_valid():
            form.save()
            return render(request, 'mainapp/calibrate.html')

        else:
            form = FaceDataForm()
            ctx['form'] = form
            return render(request, 'mainapp/index.html', ctx)
Beispiel #7
0
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")