Detail the differences between render of and render_to_response of in django

  • 2020-12-16 06:01:47
  • OfStack

Both render() and render_to_response() are used in django to display template pages, but after ES6en1.3, render() is much more attractive than render_to_response()! The most obvious is that the former uses RequestContext automatically, while the latter requires coding to enter,

Such as:


render(request,'share.html', {'registAdd': registAdd})

render_to_response('share.html',{'registAdd':registAdd},context_instance = RequestContext(request))

Related articles: