1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #34140 -- Corrected rst code-block and various formatting issues in docs.

This commit is contained in:
Joseph Victor Zammit
2023-01-23 21:29:05 +01:00
committed by Mariusz Felisiak
parent c67ea79aa9
commit ba755ca131
57 changed files with 443 additions and 269 deletions

View File

@@ -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

View File

@@ -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()