summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/templates/api.txt7
-rw-r--r--docs/releases/1.9.txt3
2 files changed, 10 insertions, 0 deletions
diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
index 05a6539988..b8e74b75ec 100644
--- a/docs/ref/templates/api.txt
+++ b/docs/ref/templates/api.txt
@@ -420,6 +420,13 @@ dictionary syntax::
Returns the value for ``key`` if ``key`` is in the context, else returns
``otherwise``.
+.. method:: Context.setdefault(key, default=None)
+
+ .. versionadded:: 1.9
+
+ If ``key`` is in the context, returns its value. Otherwise inserts ``key``
+ with a value of ``default`` and returns ``default``.
+
.. method:: Context.pop()
.. method:: Context.push()
.. exception:: ContextPopException
diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt
index 08d79cb59a..4375ba2a0d 100644
--- a/docs/releases/1.9.txt
+++ b/docs/releases/1.9.txt
@@ -166,6 +166,9 @@ Templates
helper can now store results in a template variable by using the ``as``
argument.
+* Added a :meth:`Context.setdefault() <django.template.Context.setdefault>`
+ method.
+
Requests and Responses
^^^^^^^^^^^^^^^^^^^^^^