mirror of
https://github.com/django/django.git
synced 2025-10-25 22:56:12 +00:00
[1.11.x] Fixed #28242 -- Moved ImageField file extension validation to the form field.
Backport of a0c07d77fc from master
This commit is contained in:
committed by
Tim Graham
parent
af9a81aa7f
commit
110bd82038
@@ -214,6 +214,17 @@ try:
|
||||
|
||||
def __str__(self):
|
||||
return self.description
|
||||
|
||||
class NoExtensionImageFile(models.Model):
|
||||
def upload_to(self, filename):
|
||||
return 'tests/no_extension'
|
||||
|
||||
description = models.CharField(max_length=20)
|
||||
image = models.ImageField(storage=temp_storage, upload_to=upload_to)
|
||||
|
||||
def __str__(self):
|
||||
return self.description
|
||||
|
||||
except ImportError:
|
||||
test_images = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user