diff --git a/program/migrations/0121_remove_schedule_default_playlist_id_and_more.py b/program/migrations/0121_remove_schedule_default_playlist_id_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..f6b9aff5391e74714b8c21d421c816a2bf92d38d --- /dev/null +++ b/program/migrations/0121_remove_schedule_default_playlist_id_and_more.py @@ -0,0 +1,44 @@ +# Generated by Django 4.2.16 on 2024-10-29 21:28 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("program", "0120_playlistentry"), + ] + + operations = [ + migrations.RemoveField( + model_name="schedule", + name="default_playlist_id", + ), + migrations.RemoveField( + model_name="show", + name="default_playlist_id", + ), + migrations.AddField( + model_name="schedule", + name="default_playlist", + field=models.ForeignKey( + help_text="Playlist in case a timeslot’s playlist_id of this schedule is empty.", + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="program.playlist", + ), + ), + migrations.AddField( + model_name="show", + name="default_playlist", + field=models.ForeignKey( + help_text="Playlist in case a timeslot’s playlist_id of this show is empty.", + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="program.playlist", + ), + ), + ] diff --git a/program/models.py b/program/models.py index 982796ea35bc061e19ad6edae56490eeccbf88c2..ec4ce5fc1c163994ec9188e326c28cfe2c433bbb 100644 --- a/program/models.py +++ b/program/models.py @@ -238,7 +238,13 @@ 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_id = models.IntegerField(blank=True, null=True) + default_playlist = models.ForeignKey( + "Playlist", + help_text="Playlist in case a timeslot’s playlist_id of this show is empty.", + null=True, + on_delete=models.SET_NULL, + related_name="+", + ) description = models.TextField(blank=True, help_text="Description of this show.") email = models.EmailField(blank=True, null=True, help_text="Email address of this show.") funding_category = models.ForeignKey( @@ -404,10 +410,12 @@ class Schedule(models.Model): ], null=True, ) - default_playlist_id = models.IntegerField( - blank=True, + default_playlist = models.ForeignKey( + "Playlist", + help_text="Playlist in case a timeslot’s playlist_id of this schedule is empty.", null=True, - help_text="A tank ID in case the timeslot's playlist_id is empty.", + on_delete=models.SET_NULL, + related_name="+", ) end_time = models.TimeField(null=True, help_text="End time of schedule.") first_date = models.DateField(help_text="Start date of schedule.")