X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ab8ffbde2df33d9c699e029ba613d2b014ba44b8..dbb1ae2cf25105f7a3831961b08386a1326baef8:/apps/picture/templatetags/picture_tags.py diff --git a/apps/picture/templatetags/picture_tags.py b/apps/picture/templatetags/picture_tags.py index 826f6aaf5..62826103b 100644 --- a/apps/picture/templatetags/picture_tags.py +++ b/apps/picture/templatetags/picture_tags.py @@ -1,10 +1,12 @@ +# -*- coding: utf-8 -*- +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# from django import template -from django.template import Node, Variable, Template, Context from catalogue.utils import split_tags -from itertools import chain from ..engine import CustomCroppingEngine import sorl.thumbnail.default -import logging +import logging register = template.Library() @@ -20,7 +22,7 @@ def picture_short(context, picture): 'tags': split_tags(picture.tags), }) return context - + @register.inclusion_tag('picture/picture_wide.html', takes_context=True) def picture_wide(context, picture): context.update({ @@ -47,7 +49,8 @@ def area_thumbnail_url(area, geometry): return [[coords[0][0], coords[0][1] + h/2 - w/2], [coords[1][0], coords[1][1] - h/2 + w/2, ]] - # so much for sorl extensibility. # what to do about this? + # so much for sorl extensibility. + # what to do about this? _engine = sorl.thumbnail.default.engine sorl.thumbnail.default.engine = cropper coords = to_square(area.area) @@ -64,7 +67,3 @@ def area_thumbnail_url(area, geometry): sorl.thumbnail.default.engine = _engine return th.url - - - -