Skip to content
Snippets Groups Projects
Verified Commit af64c5cc authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

feat: add aspect ratio and shape to host/note/show images & show logo

parent 3995c6b8
No related branches found
No related tags found
No related merge requests found
# Generated by Django 4.2.13 on 2024-06-03 16:43
import program.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("program", "0090_alter_playlist_options"),
]
operations = [
migrations.AddField(
model_name="radiosettings",
name="host_image_aspect_ratio",
field=program.models.ImageAspectRadioField(
choices=[("1:1", "1:1"), ("16:9", "16:9")], default="1:1", max_length=4
),
),
migrations.AddField(
model_name="radiosettings",
name="host_image_shape",
field=program.models.ImageShapeField(
choices=[("rect", "rect"), ("round", "round")], default="round", max_length=5
),
),
migrations.AddField(
model_name="radiosettings",
name="note_image_aspect_ratio",
field=program.models.ImageAspectRadioField(
choices=[("1:1", "1:1"), ("16:9", "16:9")], default="16:9", max_length=4
),
),
migrations.AddField(
model_name="radiosettings",
name="note_image_shape",
field=program.models.ImageShapeField(
choices=[("rect", "rect"), ("round", "round")], default="rect", max_length=5
),
),
migrations.AddField(
model_name="radiosettings",
name="show_image_aspect_ratio",
field=program.models.ImageAspectRadioField(
choices=[("1:1", "1:1"), ("16:9", "16:9")], default="16:9", max_length=4
),
),
migrations.AddField(
model_name="radiosettings",
name="show_image_shape",
field=program.models.ImageShapeField(
choices=[("rect", "rect"), ("round", "round")], default="rect", max_length=5
),
),
migrations.AddField(
model_name="radiosettings",
name="show_logo_aspect_ratio",
field=program.models.ImageAspectRadioField(
choices=[("1:1", "1:1"), ("16:9", "16:9")], default="1:1", max_length=4
),
),
migrations.AddField(
model_name="radiosettings",
name="show_logo_shape",
field=program.models.ImageShapeField(
choices=[("rect", "rect"), ("round", "round")], default="rect", max_length=5
),
),
]
......@@ -526,13 +526,43 @@ class Playlist(models.Model):
]
class ImageAspectRadioField(models.CharField):
def __init__(self, *args, **kwargs):
kwargs["choices"] = [
("1:1", "1:1"),
("16:9", "16:9"),
]
kwargs["max_length"] = 4
super().__init__(*args, **kwargs)
class ImageShapeField(models.CharField):
def __init__(self, *args, **kwargs):
kwargs["choices"] = [
("rect", "rect"),
("round", "round"),
]
kwargs["max_length"] = 5
super().__init__(*args, **kwargs)
class RadioSettings(models.Model):
cba_api_key = models.CharField(blank=True, max_length=64, verbose_name="CBA API key")
cba_domains = models.JSONField(
blank=True, default=list, help_text="JSON array of strings", verbose_name="CBA domains"
)
fallback_show = models.ForeignKey(Show, blank=True, null=True, on_delete=models.CASCADE)
host_image_aspect_ratio = ImageAspectRadioField(default="1:1")
host_image_shape = ImageShapeField(default="round")
line_in_channels = models.JSONField(blank=True, default=dict, help_text="JSON key/value pairs")
note_image_aspect_ratio = ImageAspectRadioField(default="16:9")
note_image_shape = ImageShapeField(default="rect")
show_image_aspect_ratio = ImageAspectRadioField(default="16:9")
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)
station_name = models.CharField(max_length=256, unique=True)
station_website = models.URLField()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment