summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Wohlwend <piquadrat@gmail.com>2015-09-16 14:51:14 +0200
committerTim Graham <timograham@gmail.com>2015-10-22 14:11:52 -0400
commit840e97ab018ef0901fe4731d7502a7e2baf6546b (patch)
treeb11aa8abbde7eb6524da94d4bdfc6fe017de4f43
parent6861c2027da87cd9606cef8530e738613bb8c293 (diff)
downloaddjango-840e97ab018ef0901fe4731d7502a7e2baf6546b.tar.gz
[1.8.x] Refs #24622 -- Documented alternatives to some test response attributes when using alternative template engines.
Backport of 2b9eed41fa26537d1af4f818c6e4296ce3305b01 from master
-rw-r--r--docs/topics/testing/tools.txt17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index bda519d31c..315cccad73 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -436,6 +436,14 @@ Specifically, a ``Response`` object has the following attributes:
>>> response.context['name']
'Arthur'
+ .. admonition:: Not using Django templates?
+
+ This attribute is only populated when using the
+ :class:`~django.template.backends.django.DjangoTemplates` backend.
+ If you're using another template engine,
+ :attr:`~django.template.response.SimpleTemplateResponse.context_data`
+ may be a suitable alternative on responses with that attribute.
+
.. attribute:: request
The request data that stimulated the response.
@@ -460,6 +468,15 @@ Specifically, a ``Response`` object has the following attributes:
loaded from a file. (The name is a string such as
``'admin/index.html'``.)
+ .. admonition:: Not using Django templates?
+
+ This attribute is only populated when using the
+ :class:`~django.template.backends.django.DjangoTemplates` backend.
+ If you're using another template engine,
+ :attr:`~django.template.response.SimpleTemplateResponse.template_name`
+ may be a suitable alternative if you only need the name of the
+ template used for rendering.
+
.. attribute:: resolver_match
.. versionadded:: 1.8