summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorThomas Tanner <tanner@gmx.net>2014-11-29 17:41:06 +0100
committerTim Graham <timograham@gmail.com>2014-12-04 07:42:03 -0500
commit018d110ef547acb71b0526d0ff934e1e476244e4 (patch)
treef8abd2126879aa8f9f543be5be7847027e1c549e /docs
parentdc2d75f4d43ca735bfdded52ff90458ebecb9348 (diff)
Fixed #23911 -- Added support for buffer file uploads in the test client
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/1.8.txt2
-rw-r--r--docs/topics/testing/tools.txt7
2 files changed, 9 insertions, 0 deletions
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index d95599f613..375a39920f 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -511,6 +511,8 @@ Tests
:meth:`TestCase.setUpTestData() <django.test.TestCase.setUpTestData>`. Using
this technique can speed up the tests as compared to using ``setUp()``.
+* Added test client support for file uploads with file-like objects.
+
Validators
^^^^^^^^^^
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index 454da239e0..69649d7a2e 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -238,6 +238,13 @@ Use the ``django.test.Client`` class to make requests.
(The name ``attachment`` here is not relevant; use whatever name your
file-processing code expects.)
+ You may also provide any file-like object (e.g., :class:`~io.StringIO` or
+ :class:`~io.BytesIO`) as a file handle.
+
+ .. versionadded:: 1.8
+
+ The ability to use a file-like object was added.
+
Note that if you wish to use the same file handle for multiple
``post()`` calls then you will need to manually reset the file
pointer between posts. The easiest way to do this is to