mirror of
https://github.com/django/django.git
synced 2025-04-26 10:14:36 +00:00
Fixed #13754 - Add a note about a test client session property gotcha
Thanks SmileyChris for report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13685 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
bdd13a4daa
commit
027aaca37f
@ -935,6 +935,15 @@ can access these properties as part of a test condition.
|
|||||||
A dictionary-like object containing session information. See the
|
A dictionary-like object containing session information. See the
|
||||||
:doc:`session documentation</topics/http/sessions>` for full details.
|
:doc:`session documentation</topics/http/sessions>` for full details.
|
||||||
|
|
||||||
|
To modify the session and then save it, it must be stored in a variable
|
||||||
|
first (because a new ``SessionStore`` is created every time this property
|
||||||
|
is accessed)::
|
||||||
|
|
||||||
|
def test_something(self):
|
||||||
|
session = self.client.session
|
||||||
|
session['somekey'] = 'test'
|
||||||
|
session.save()
|
||||||
|
|
||||||
.. _Cookie module documentation: http://docs.python.org/library/cookie.html
|
.. _Cookie module documentation: http://docs.python.org/library/cookie.html
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
Loading…
x
Reference in New Issue
Block a user