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

feat: rename default_playlist -> default_media in Schedule & Show models

parent 4df687bf
No related branches found
No related tags found
No related merge requests found
# Generated by Django 4.2.18 on 2025-01-21 18:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("program", "0140_alter_media_options"),
]
operations = [
migrations.RenameField(
model_name="schedule",
old_name="default_playlist",
new_name="default_media",
),
migrations.RenameField(
model_name="show",
old_name="default_playlist",
new_name="default_media",
),
]
# Generated by Django 4.2.18 on 2025-01-21 18:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("program", "0141_rename_default_playlist_schedule_default_media_and_more"),
]
operations = [
migrations.AlterField(
model_name="schedule",
name="default_media",
field=models.ForeignKey(
help_text="Media in case a timeslot’s media_id of this schedule is empty.",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="program.media",
),
),
migrations.AlterField(
model_name="show",
name="default_media",
field=models.ForeignKey(
help_text="Media in case a timeslot’s media_id of this show is empty.",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="program.media",
),
),
]
......@@ -265,9 +265,9 @@ class Show(models.Model):
cba_series_id = models.IntegerField(blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.CharField(max_length=150)
default_playlist = models.ForeignKey(
default_media = models.ForeignKey(
"Media",
help_text="Playlist in case a timeslot’s playlist_id of this show is empty.",
help_text="Media in case a timeslot’s media_id of this show is empty.",
null=True,
on_delete=models.SET_NULL,
related_name="+",
......@@ -437,9 +437,9 @@ class Schedule(models.Model):
],
null=True,
)
default_playlist = models.ForeignKey(
default_media = models.ForeignKey(
"Media",
help_text="Playlist in case a timeslot’s playlist_id of this schedule is empty.",
help_text="Media in case a timeslot’s media_id of this schedule is empty.",
null=True,
on_delete=models.SET_NULL,
related_name="+",
......@@ -812,13 +812,13 @@ class ProgramEntry:
timeslot: TimeSlot | None
@cached_property
def playlist_id(self) -> int | None:
def media_id(self) -> int | None:
if timeslot := self.timeslot:
if timeslot.episode and (playlist_id := timeslot.episode.playlist_id):
return playlist_id
if playlist_id := timeslot.schedule.default_playlist_id:
return playlist_id
return self.show.default_playlist_id
if timeslot.episode and (media_id := timeslot.episode.media_id):
return media_id
if media_id := timeslot.schedule.default_media_id:
return media_id
return self.show.default_media_id
class ApplicationStateManager:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment