diff --git a/program/migrations/0104_radiosettings_station_logo_height_and_more.py b/program/migrations/0104_radiosettings_station_logo_height_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..b9ccaf4e7984d719109cf0563ac9442075e37d14 --- /dev/null +++ b/program/migrations/0104_radiosettings_station_logo_height_and_more.py @@ -0,0 +1,36 @@ +# Generated by Django 4.2.13 on 2024-06-26 22:05 + +import versatileimagefield.fields + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("program", "0103_alter_radiosettings_fallback_default_pool"), + ] + + operations = [ + migrations.AddField( + model_name="radiosettings", + name="station_logo_height", + field=models.PositiveIntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name="radiosettings", + name="station_logo_width", + field=models.PositiveIntegerField(blank=True, null=True), + ), + migrations.AlterField( + model_name="radiosettings", + name="station_logo", + field=versatileimagefield.fields.VersatileImageField( + blank=True, + height_field="station_logo_height", + null=True, + upload_to="images", + width_field="station_logo_width", + ), + ), + ] diff --git a/program/models.py b/program/models.py index 44002ed8ef91b9026aa94a253628cb71017f68c2..11c37e700649c0edf1aaf9b75f46f8d29c6cab1c 100644 --- a/program/models.py +++ b/program/models.py @@ -660,9 +660,15 @@ class RadioSettings(models.Model): show_image_shape = ImageShapeField(default="rect") show_logo_aspect_ratio = ImageAspectRadioField(default="1:1") show_logo_shape = ImageShapeField(default="rect") - station_logo = models.ForeignKey( - Image, blank=True, null=True, on_delete=models.CASCADE, related_name="+" + station_logo = VersatileImageField( + blank=True, + height_field="station_logo_height", + null=True, + upload_to="images", + width_field="station_logo_width", ) + station_logo_height = models.PositiveIntegerField(blank=True, null=True) + station_logo_width = models.PositiveIntegerField(blank=True, null=True) station_name = models.CharField(max_length=256, unique=True) station_website = models.URLField()