diff options
| author | Marcelo Galigniana <marcelogaligniana@gmail.com> | 2022-10-16 23:02:56 -0300 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-10-25 16:53:52 +0200 |
| commit | c0fc1b5302f5d9d82e2255fb5758321fbac34949 (patch) | |
| tree | d1f3990e58c227fb5338e4ce613a2dd50e459fd8 /tests/admin_widgets/models.py | |
| parent | 64e5ef1f17cd18cb8ca24f4e7107dfd28c18b378 (diff) | |
Fixed #19215 -- Fixed rendering ClearableFileInput when editing with invalid files.
Thanks Michael Cardillo for the initial patch.
Diffstat (limited to 'tests/admin_widgets/models.py')
| -rw-r--r-- | tests/admin_widgets/models.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/admin_widgets/models.py b/tests/admin_widgets/models.py index 15d7a3022e..26eaf5d243 100644 --- a/tests/admin_widgets/models.py +++ b/tests/admin_widgets/models.py @@ -1,8 +1,13 @@ +import tempfile import uuid from django.contrib.auth.models import User +from django.core.files.storage import FileSystemStorage from django.db import models +temp_storage_dir = tempfile.mkdtemp() +temp_storage = FileSystemStorage(temp_storage_dir) + class MyFileField(models.FileField): pass @@ -177,6 +182,9 @@ class Advisor(models.Model): class Student(models.Model): name = models.CharField(max_length=255) + photo = models.ImageField( + storage=temp_storage, upload_to="photos", blank=True, null=True + ) class Meta: ordering = ("name",) |
