mirror of
https://github.com/django/django.git
synced 2025-01-18 14:24:39 +00:00
Fixed #33965 -- Improved file-like object example of ImageField in docs.
This uses a valid image.
This commit is contained in:
parent
12617fbd85
commit
838cc0f449
@ -257,8 +257,11 @@ Use the ``django.test.Client`` class to make requests.
|
|||||||
For example::
|
For example::
|
||||||
|
|
||||||
>>> from io import BytesIO
|
>>> from io import BytesIO
|
||||||
>>> img = BytesIO(b'mybinarydata')
|
>>> img = BytesIO(
|
||||||
>>> img.name = 'myimage.jpg'
|
... 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
|
Note that if you wish to use the same file handle for multiple
|
||||||
``post()`` calls then you will need to manually reset the file
|
``post()`` calls then you will need to manually reset the file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user