mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Refs #34140 -- Corrected rst code-block and various formatting issues in docs.
This commit is contained in:
committed by
Mariusz Felisiak
parent
c67ea79aa9
commit
ba755ca131
@@ -1429,7 +1429,7 @@ need to bind the file data containing the mugshot image:
|
||||
... 'message': 'Hi there',
|
||||
... 'sender': 'foo@example.com',
|
||||
... 'cc_myself': True}
|
||||
>>> file_data = {'mugshot': SimpleUploadedFile('face.jpg', <file data>)}
|
||||
>>> file_data = {'mugshot': SimpleUploadedFile('face.jpg', b"file data")}
|
||||
>>> f = ContactFormWithMugshot(data, file_data)
|
||||
|
||||
In practice, you will usually specify ``request.FILES`` as the source
|
||||
|
||||
@@ -746,7 +746,7 @@ For each field, we describe the default widget used if you don't specify
|
||||
>>> from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
>>> class ImageForm(forms.Form):
|
||||
... img = forms.ImageField()
|
||||
>>> file_data = {'img': SimpleUploadedFile('test.png', <file data>)}
|
||||
>>> file_data = {'img': SimpleUploadedFile('test.png', b"file data")}
|
||||
>>> form = ImageForm({}, file_data)
|
||||
# Pillow closes the underlying file descriptor.
|
||||
>>> form.is_valid()
|
||||
|
||||
Reference in New Issue
Block a user