mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Fixed #24493 -- Added BaseContext.setdefault()
This commit is contained in:
parent
4d9414098b
commit
388e79e9fc
4 changed files with 28 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue