From 46b3e3ffdc25b5a42762df20e536401fc512c5f3 Mon Sep 17 00:00:00 2001 From: Collin Anderson Date: Tue, 30 Jan 2018 09:42:23 -0500 Subject: [PATCH] Fixed #29065 -- Made django.core.validators only load Pillow if needed. --- django/core/validators.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/django/core/validators.py b/django/core/validators.py index 3e39b9db93..965f35cbab 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -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