summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAlex Morega <alex@grep.ro>2022-08-31 11:32:18 +0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-08-31 13:17:46 +0200
commit27ad94ab3b0d4f5da74b10c4d5e768070139ec77 (patch)
tree74e92a504e18058276234be4917114f27c64c4b4 /docs
parent29fac6b6160ffd9c6e9b37ed2ed964d292575545 (diff)
[4.1.x] Fixed #33965 -- Improved file-like object example of ImageField in docs.
This uses a valid image. Backport of 838cc0f449f96c157cb44eb91984a2753edc7f42 from main
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/testing/tools.txt7
1 files changed, 5 insertions, 2 deletions
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index e981e2ab02..61788d2c1d 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -257,8 +257,11 @@ Use the ``django.test.Client`` class to make requests.
For example::
>>> from io import BytesIO
- >>> img = BytesIO(b'mybinarydata')
- >>> img.name = 'myimage.jpg'
+ >>> img = BytesIO(
+ ... b"GIF89a\x01\x00\x01\x00\x00\x00\x00!\xf9\x04\x01\x00\x00\x00"
+ ... b"\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x01\x00\x00"
+ ... )
+ >>> img.name = "myimage.gif"
Note that if you wish to use the same file handle for multiple
``post()`` calls then you will need to manually reset the file