Fixed -- Made django.core.validators only load Pillow if needed.
@@ -510,9 +510,8 @@ def get_available_image_extensions():
return [ext.lower()[1:] for ext in Image.EXTENSION]
-validate_image_file_extension = FileExtensionValidator(
- allowed_extensions=get_available_image_extensions(),
-)
+def validate_image_file_extension(value):
+ return FileExtensionValidator(allowed_extensions=get_available_image_extensions())(value)
@deconstructible
