mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
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
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user