django render_to_response is not defined error
Did you try import render_to_response as from django.shortcuts import render_to_response
?
from django.shortcuts import render_to_response is deprecated. use django.shortcuts import render
def renderView(request):
input = "Best Times, render"
return render(request,'mytest/home.html',{'mytime': input})
If you're reading this beyond - 2017 , don't render_to_response
just render
:
https://docs.djangoproject.com/en/1.11/topics/http/shortcuts/#render-to-response
Source - Django official documentation for version - 1.11
" render_to_response()¶
render_to_response(template_name, context=None, content_type=None, status=None, using=None)[source]¶
This function preceded the introduction of render() and works similarly except that it doesn’t make the request available in the response.
It’s not recommended and is likely to be deprecated in the future."