Django – Why should I ever use the render_to_response at all?

Most of the apps use render_to_response since it was the default recommended option since the very beginning until Django 1.3. The reason for the coexistence of both is historical, deprecating render_to_response will force a lot of code to be rewritten, which is not polite in minor releases. However in this django-developer thread they say it would be possible to include in the deprecation timeline for 2.0.

Here’s the quote by Russell Keith-Magee, one of Django’s core developers. Keith-Magee answers a question posted by Jacob Kaplan-Moss, another Django contributer who raises the question of deprecating render_to_response:

I think we should deprecate render_to_response() in favor of render().
render_to_response() is just render(request=None, …), right? Any
reason to keep both around? There’s no particular reason to keep both around, other than the code churn that deprecation would entail.

And Keith-Magee answers:

This is something that I have no problem deprecating on the 2.0
schedule, but migrating every use of render_to_response() over the
next 18 months/2 releases seems like an extreme measure to enforce on
the entire user base when maintaining render_to_response() doesn’t
take any real effort.

Nobody’s been discussing that deprecation, but I guess the answer for your question is: There’s no technical reason, it’s just their intent not to force an update on all the codebase in a minor (at least no major) release.

Leave a Comment