I've got a view that I'm trying to test with the Client
object. Can I get to the variables I injected into the render_to_response
of my view?
Example View:
def myView(request):
if request.method == "POST":
# do the search
return render_to_response('search.html',{'results':results},context_instance=RequestContext(request))
else:
return render_to_response('search.html',context_instance=RequestContext(request))
Test:
c = Client()
response = c.post('/school/search/', {'keyword':'beagles'})
# how do I get to the 'results'
EDIT:
From the Docs, I'm pretty certain I should be using:response.context["results"]
...but response.context
AND response.template
both return None