summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-11-22 09:22:38 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-11-22 17:58:38 +0100
commit733178830072caeca3c054a220808b4c557faec4 (patch)
tree74d0eeee1edc9f2861aea82599ab6bc63cbcd2c2 /docs
parentbf1bd0fbc9d4920327ad998ad11facf842492e23 (diff)
Avoided rewrapping Contexts in render_to_response.
This change preserves backwards-compatibility for a very common misuse of render_to_response which even occurred in the official documentation. It fixes that misuse wherever it happened in the code base and docs. Context.__init__ is documented as accepting a dict and nothing else. Since Context is dict-like, Context(Context({})) could work to some extent. However, things get complicated with RequestContext and that gets in the way of refactoring the template engine. This is the real rationale for this change.
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/i18n/translation.txt5
1 files changed, 2 insertions, 3 deletions
diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt
index 8ef9b89c6b..daf66d332b 100644
--- a/docs/topics/i18n/translation.txt
+++ b/docs/topics/i18n/translation.txt
@@ -860,9 +860,8 @@ If you do this in your view:
.. code-block:: python
- return render_to_response('mytemplate.html', {
- 'available_languages': ['en', 'es', 'fr'],
- }, RequestContext(request))
+ context = {'available_languages': ['en', 'es', 'fr']}
+ return render(request, 'mytemplate.html', context)
you can iterate over those languages in the template::