diff --git a/api/catalog/api/admin/__init__.py b/api/catalog/api/admin/__init__.py index b34b72a5d..3da8cc216 100644 --- a/api/catalog/api/admin/__init__.py +++ b/api/catalog/api/admin/__init__.py @@ -1,13 +1,7 @@ from django.contrib import admin from catalog.api.admin.site import openverse_admin -from catalog.api.models import ( - PENDING, - AudioReport, - ContentProvider, - ImageReport, - SourceLogo, -) +from catalog.api.models import PENDING, AudioReport, ContentProvider, ImageReport from catalog.api.models.media import AbstractDeletedMedia, AbstractMatureMedia @@ -73,13 +67,8 @@ def has_add_permission(self, *args, **kwargs): admin.site.register(klass, MediaSubreportAdmin) -class InlineImage(admin.TabularInline): - model = SourceLogo - - @admin.register(ContentProvider) class ProviderAdmin(admin.ModelAdmin): list_display = ("provider_name", "provider_identifier", "media_type") search_fields = ("provider_name", "provider_identifier") exclude = ("notes",) - inlines = [InlineImage] diff --git a/api/catalog/api/migrations/0051_delete_sourcelogo.py b/api/catalog/api/migrations/0051_delete_sourcelogo.py new file mode 100644 index 000000000..e3bd11d80 --- /dev/null +++ b/api/catalog/api/migrations/0051_delete_sourcelogo.py @@ -0,0 +1,16 @@ +# Generated by Django 4.1 on 2022-10-24 23:48 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0050_audio_model_plural_names'), + ] + + operations = [ + migrations.DeleteModel( + name='SourceLogo', + ), + ] diff --git a/api/catalog/api/models/__init__.py b/api/catalog/api/models/__init__.py index e9d532883..eb95eccd4 100644 --- a/api/catalog/api/models/__init__.py +++ b/api/catalog/api/models/__init__.py @@ -24,7 +24,7 @@ OTHER, PENDING, ) -from catalog.api.models.models import ContentProvider, SourceLogo, Tag +from catalog.api.models.models import ContentProvider, Tag from catalog.api.models.oauth import ( OAuth2Registration, OAuth2Verification, diff --git a/api/catalog/api/models/models.py b/api/catalog/api/models/models.py index b5b485b12..b267e3153 100644 --- a/api/catalog/api/models/models.py +++ b/api/catalog/api/models/models.py @@ -36,11 +36,6 @@ class Meta: db_table = "content_provider" -class SourceLogo(models.Model): - source = models.OneToOneField(ContentProvider, on_delete=models.CASCADE) - image = models.ImageField() - - class Tag(OpenLedgerModel): foreign_identifier = models.CharField(max_length=255, blank=True, null=True) name = models.CharField(max_length=1000, blank=True, null=True) diff --git a/api/catalog/api/serializers/provider_serializers.py b/api/catalog/api/serializers/provider_serializers.py index 0a2213c18..62e567962 100644 --- a/api/catalog/api/serializers/provider_serializers.py +++ b/api/catalog/api/serializers/provider_serializers.py @@ -1,8 +1,6 @@ from rest_framework import serializers -from drf_yasg.utils import swagger_serializer_method - -from catalog.api.models import ContentProvider, SourceLogo +from catalog.api.models import ContentProvider class ProviderSerializer(serializers.ModelSerializer): @@ -18,8 +16,8 @@ class ProviderSerializer(serializers.ModelSerializer): source="domain_name", help_text="The URL of the source, e.g. https://www.flickr.com", ) - logo_url = serializers.SerializerMethodField( - help_text="The URL to a logo of the source.", + logo_url = serializers.ReadOnlyField( + default=None, help_text="Deprecated and unused. Always `null`." ) media_count = serializers.SerializerMethodField( help_text="The number of media items indexed from the source.", @@ -35,17 +33,6 @@ class Meta: "media_count", ] - @swagger_serializer_method(serializer_or_field=serializers.URLField) - def get_logo_url(self, obj): - try: - source_logo = obj.sourcelogo - except SourceLogo.DoesNotExist: - return None - logo_path = source_logo.image.url - request = self.context.get("request") - if request is not None: - return request.build_absolute_uri(logo_path) - def get_media_count(self, obj) -> int: source_counts = self.context.get("source_counts") return source_counts.get(obj.provider_identifier) diff --git a/api/catalog/settings.py b/api/catalog/settings.py index e9e1baa28..268ebb623 100644 --- a/api/catalog/settings.py +++ b/api/catalog/settings.py @@ -33,10 +33,6 @@ # Where to collect static files in production/development deployments STATIC_ROOT = "/var/api_static_content/static" -# Logo uploads -MEDIA_ROOT = "/var/api_media/" -MEDIA_URL = "/media/" - # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/