diff options
| author | Preston Timmons <prestontimmons@gmail.com> | 2015-03-11 11:00:17 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-03-16 13:13:02 -0400 |
| commit | 388e79e9fcbf689d5708134534e55d176cfbcee3 (patch) | |
| tree | 8a0e1ae3570f4f3ca59ed4cfa55c7e747cd3dba5 /docs | |
| parent | 4d9414098bd98aacd241827a01f6ad2dff71f113 (diff) | |
Fixed #24493 -- Added BaseContext.setdefault()
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/templates/api.txt | 7 | ||||
| -rw-r--r-- | docs/releases/1.9.txt | 3 |
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 ^^^^^^^^^^^^^^^^^^^^^^ |
