diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-03-18 10:46:55 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-03-18 10:46:55 +0000 |
| commit | ee2f04d79e5bca55637b9bb3301618738a4e342a (patch) | |
| tree | 91e94bc284c1cb44ce131b8acc972e3585b2b110 /docs/topics/testing.txt | |
| parent | 61a2708c4108939795c70cf124d5696275d6c255 (diff) | |
Fixed #10482 -- Unified access to response.context when inspecting responses from the test client. Thanks to James Bennett for the design, and Julien Phalip for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10084 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/topics/testing.txt')
| -rw-r--r-- | docs/topics/testing.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt index e1c3c2e06c..974856b0c4 100644 --- a/docs/topics/testing.txt +++ b/docs/topics/testing.txt @@ -712,6 +712,16 @@ Specifically, a ``Response`` object has the following attributes: If the rendered page used multiple templates, then ``context`` will be a list of ``Context`` objects, in the order in which they were rendered. + .. versionadded:: 1.1 + + Regardless of the number of templates used during rendering, you can + retrieve context values using the ``[]`` operator. For example, the + context variable ``name`` could be retrieved using:: + + >>> response = client.get('/foo/') + >>> response.context['name'] + 'Arthur' + .. attribute:: request The request data that stimulated the response. |
