mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #19215 -- Fixed rendering ClearableFileInput when editing with invalid files.
Thanks Michael Cardillo for the initial patch.
This commit is contained in:
committed by
Mariusz Felisiak
parent
64e5ef1f17
commit
c0fc1b5302
@@ -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",)
|
||||
|
||||
Reference in New Issue
Block a user