diff --git a/sapl/settings.py b/sapl/settings.py index 31905aa07..2e6b7c7ff 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -188,6 +188,9 @@ THUMBNAIL_PROCESSORS = ( 'image_cropping.thumbnail_processors.crop_corners', ) + thumbnail_settings.THUMBNAIL_PROCESSORS +THUMBNAIL_SOURCE_GENERATORS = ( + 'sapl.utils.pil_image', +) # troque no caso de reimplementaĆ§Ć£o da classe User conforme # https://docs.djangoproject.com/en/1.9/topics/auth/customizing/#substituting-a-custom-user-model diff --git a/sapl/utils.py b/sapl/utils.py index 01f0f5f2b..3a3cb3fad 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -1,13 +1,11 @@ +from functools import wraps +from operator import itemgetter +from unicodedata import normalize as unicodedata_normalize import hashlib import logging import os import re -from functools import wraps -from operator import itemgetter -from unicodedata import normalize as unicodedata_normalize -import django_filters -import magic from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Button from django import forms @@ -21,14 +19,23 @@ from django.db.models import Q from django.utils import six, timezone from django.utils.translation import ugettext_lazy as _ from django_filters.filterset import STRICTNESS +from easy_thumbnails import source_generators from floppyforms import ClearableFileInput from reversion.admin import VersionAdmin +import django_filters +import magic + from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row from sapl.settings import BASE_DIR + sapl_logger = logging.getLogger(BASE_DIR.name) +def pil_image(source, exif_orientation=False, **options): + return source_generators.pil_image(source, exif_orientation, **options) + + def normalize(txt): return unicodedata_normalize( 'NFKD', txt).encode('ASCII', 'ignore').decode('ASCII')