1👍
You need to use function render_to_response
, like what you didi to device_qa_build_form.html
in your code.
You will have to modify qa_results.html
to give it a variable called form
, then using render_to_response
. Something like this:
if request.method == 'POST':
form = Device_qa_Form(request.POST )
if form.is_valid():
cd = form.cleaned_data
Device_build_test.set_up(
cd
)
# return HttpResponseRedirect('/qa_results.html/')
return render_to_response('/qa_results.html/', {'form':form})
else:
form = Device_qa_Form()
return render_to_response('device_qa_build_form.html', {'form':form} )
Here is instruction of render_to_response for you.
https://docs.djangoproject.com/en/1.7/topics/http/shortcuts/
0👍
I got it to work this way… getting the returned data and creating the context sending it on. If anyone thinks this is a bad idea let me know.
if request.method == 'POST':
form = Device_qa_Form(request.POST )
if form.is_valid():
cd = form.cleaned_data
results = Device_build_test.set_up(
cd
)
t = loader.get_template('qa_results.html')
c = Context({'results':results})
return HttpResponse( t.render(c))
else:
form = Device_qa_Form()
return render_to_response('device_qa_build_form.html', {'form':form} )
- [Answer]-A light weight framework to host HTML files produced
- [Answer]-Dynamic table name and dynamic field for django 1.8
- [Answer]-Django-tastypie how to assign default value in id
Source:stackexchange.com