mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue