diff --git a/docs/topics/files.txt b/docs/topics/files.txt
index 88f2bc9..80455a8 100644
a
|
b
|
it has all the methods and attributes described below.
|
55 | 55 | file name used on disk cannot be relied on until after the model has been |
56 | 56 | saved. |
57 | 57 | |
| 58 | .. note:: |
| 59 | Accessing an image field (or other file-like field) on a model returns |
| 60 | a closed file reference. |
| 61 | |
58 | 62 | |
59 | 63 | The ``File`` object |
60 | 64 | =================== |
diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py
index 4208454..daf9ea8 100644
a
|
b
|
class AbstractForeignFieldsModel(models.Model):
|
384 | 384 | |
385 | 385 | class Meta: |
386 | 386 | abstract = True |
| 387 | |
| 388 | |
| 389 | class Profile(models.Model): |
| 390 | image = models.ImageField() |
diff --git a/tests/model_fields/test_imagefield.py b/tests/model_fields/test_imagefield.py
index 7389573..a131a49 100644
a
|
b
|
class ImageFieldTests(ImageFieldTestMixin, TestCase):
|
181 | 181 | loaded_p = pickle.loads(dump) |
182 | 182 | self.assertEqual(p.mugshot, loaded_p.mugshot) |
183 | 183 | |
| 184 | def test_image_field_io_closed_file(self): |
| 185 | """ |
| 186 | Opening 'image' property as Image object of a model's ImageField will fail |
| 187 | with an 'I/O operation on closed file' error. Regression for #13750 |
| 188 | |
| 189 | Accessing the image after saving it should return a closed file reference. |
| 190 | """ |
| 191 | from .models import Profile |
| 192 | profile = Profile() |
| 193 | profile.image = self.file1 |
| 194 | |
| 195 | profile.save() |
| 196 | |
| 197 | self.assertTrue(profile.image.closed) |
| 198 | |
184 | 199 | |
185 | 200 | @skipIf(Image is None, "Pillow is required to test ImageField") |
186 | 201 | class ImageFieldTwoDimensionsTests(ImageFieldTestMixin, TestCase): |