X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/5aa13410812d3fc4b35c039bdc3f0a2edc5185a1..65c9feda79d2b2c94cb7dcd561318a83fd796f0a:/src/catalogue/api/fields.py?ds=sidebyside diff --git a/src/catalogue/api/fields.py b/src/catalogue/api/fields.py index 145780e2b..cab947592 100644 --- a/src/catalogue/api/fields.py +++ b/src/catalogue/api/fields.py @@ -1,5 +1,8 @@ +# -*- 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 rest_framework import serializers -from sorl.thumbnail import default from catalogue.models import Book @@ -16,15 +19,3 @@ class BookLiked(serializers.ReadOnlyField): request.liked_books = None if request.liked_books is not None: return value in request.liked_books - - -class ThumbnailField(serializers.FileField): - def __init__(self, geometry, *args, **kwargs): - self.geometry = geometry - super(ThumbnailField, self).__init__(*args, **kwargs) - - def to_representation(self, value): - if value: - return super(ThumbnailField, self).to_representation( - default.backend.get_thumbnail(value, self.geometry) - )