when i call runDelete, then it will call run, so why "view didn't return an HttpResponse object" happen?
thanks:)
def run(request, build):
run_list = []
target_dict = {}
target_num = 0
build_id = 0
all_run_list = TestRun.objects.all().order_by('id')
for run in all_run_list:
build_version = run.build.version
build_number = run.build.number
run_build = build_version + '.' + build_number
if (build==run_build):
run_list.append(run)
return render_to_response('run.html', {'run_list': run_list})
def runDelete(request):
run_list = request.POST.getlist('var_delete')
build_id = request.POST.get('build_id')
for run2 in run_list:
run2 = int(run2)
build_id = int(build_id)
build_obj = Build.objects.get(id=build_id)
build_version = build_obj.version
build_number = build_obj.number
build = build_version + '.' + build_number
run(request, build)
Django views are expected to return HttpResponse
objects. Your view does call run
but it does not return anything (remember that Python functions return None
in the absence of a statement explicitly returning something else). So change this line from:
run(request, build)
to:
return run(request, build)
Of course this will only work if run
returns an HttpResponse
instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With