diff --git a/program/migrations/0122_remove_timeslot_playlist_id_timeslot_playlist.py b/program/migrations/0122_remove_timeslot_playlist_id_timeslot_playlist.py new file mode 100644 index 0000000000000000000000000000000000000000..11cbc55557e638bdbcf5483b10fe2b024d29583b --- /dev/null +++ b/program/migrations/0122_remove_timeslot_playlist_id_timeslot_playlist.py @@ -0,0 +1,30 @@ +# Generated by Django 4.2.16 on 2024-10-29 21:34 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("program", "0121_remove_schedule_default_playlist_id_and_more"), + ] + + operations = [ + migrations.RemoveField( + model_name="timeslot", + name="playlist_id", + ), + migrations.AddField( + model_name="timeslot", + name="playlist", + field=models.ForeignKey( + blank=True, + help_text="Playlist for this timeslot.", + 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 ec4ce5fc1c163994ec9188e326c28cfe2c433bbb..08aa6875032fee74be5a089486a4f50119f847af 100644 --- a/program/models.py +++ b/program/models.py @@ -459,7 +459,14 @@ class Schedule(models.Model): class TimeSlot(models.Model): end = models.DateTimeField() memo = models.TextField(blank=True, help_text="Memo for this timeslot.") - playlist_id = models.IntegerField(null=True, help_text="Playlist ID of this timeslot.") + playlist = models.ForeignKey( + "Playlist", + blank=True, + help_text="Playlist for this timeslot.", + null=True, + on_delete=models.SET_NULL, + related_name="+", + ) repetition_of = models.ForeignKey( "self", blank=True, null=True, on_delete=models.SET_NULL, related_name="repetitions" )