1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #28242 -- Moved ImageField file extension validation to the form field.

This commit is contained in:
Manatsawin Hanmongkolchai
2017-05-28 14:05:21 +07:00
committed by Tim Graham
parent 6bb3b2bff4
commit a0c07d77fc
8 changed files with 47 additions and 11 deletions

View File

@@ -192,6 +192,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