diff --git a/program/serializers.py b/program/serializers.py index b2f308997aaa7815133180c3ce56f7a5d9a1b488..efed2b30bd63dbee0865eae94fc0c27081ebe8c5 100644 --- a/program/serializers.py +++ b/program/serializers.py @@ -19,7 +19,7 @@ # import re -from typing import List, TypedDict +from typing import TypedDict from drf_jsonschema_serializer import JSONSchemaField from rest_framework import serializers @@ -266,27 +266,8 @@ class ImageSerializer(serializers.ModelSerializer): allow_null=True, queryset=License.objects.all(), required=False, source="license" ) ppoi = PPOIField(required=False) - thumbnails = serializers.SerializerMethodField() url = serializers.SerializerMethodField() - @staticmethod - def get_thumbnails(instance) -> List[Thumbnail]: - """Returns thumbnails""" - thumbnails = [] - - if instance.image.name and settings.THUMBNAIL_SIZES: - for size in settings.THUMBNAIL_SIZES: - [width, height] = size.split("x") - thumbnails.append( - { - "width": int(width), - "height": int(height), - "url": instance.image.crop[size].url, - } - ) - - return thumbnails - @staticmethod def get_url(instance: Image) -> str: """Returns the image URL, using settings.SITE_URL to include the protocol and avoid mixed @@ -301,7 +282,6 @@ class ImageSerializer(serializers.ModelSerializer): read_only_fields = ( "height", "id", - "thumbnails", "url", "width", )