diff --git a/program/migrations/0118_delete_playlist.py b/program/migrations/0118_delete_playlist.py new file mode 100644 index 0000000000000000000000000000000000000000..df20e6b217a0c3a554293b2960337d2fab7bfe83 --- /dev/null +++ b/program/migrations/0118_delete_playlist.py @@ -0,0 +1,16 @@ +# Generated by Django 4.2.16 on 2024-10-29 20:44 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("program", "0117_alter_timeslot_options"), + ] + + operations = [ + migrations.DeleteModel( + name="Playlist", + ), + ] diff --git a/program/migrations/0119_playlist.py b/program/migrations/0119_playlist.py new file mode 100644 index 0000000000000000000000000000000000000000..355f224ceecfb0674ba8f1b235b3d0cd882f6335 --- /dev/null +++ b/program/migrations/0119_playlist.py @@ -0,0 +1,48 @@ +# Generated by Django 4.2.16 on 2024-10-29 20:44 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("program", "0118_delete_playlist"), + ] + + operations = [ + migrations.CreateModel( + name="Playlist", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, primary_key=True, serialize=False, verbose_name="ID" + ), + ), + ("created_at", models.DateTimeField(auto_now_add=True)), + ("created_by", models.CharField(default="root", max_length=150)), + ("description", models.TextField(blank=True)), + ("playout_mode", models.CharField(blank=True, default="linear", max_length=8)), + ("updated_at", models.DateTimeField(auto_now=True, null=True)), + ("updated_by", models.CharField(blank=True, default="", max_length=150)), + ( + "show", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="playlists", + to="program.show", + ), + ), + ], + options={ + "permissions": [ + ("add__file", "Can add file media-source"), + ("add__import", "Can add import media-source"), + ("add__line", "Can add line media-source"), + ("add__m3ufile", "Can add m3u media-source"), + ("add__stream", "Can add stream media-source"), + ], + }, + ), + ] diff --git a/program/models.py b/program/models.py index 6984ea9a0dd150487e6a60cd7eedc9673009b79e..37520c4209d1297aaa842501e786f20925884367 100644 --- a/program/models.py +++ b/program/models.py @@ -563,6 +563,16 @@ class CBA(models.Model): class Playlist(models.Model): + created_at = models.DateTimeField(auto_now_add=True) + created_by = models.CharField(max_length=150, default="root") + description = models.TextField(blank=True) + playout_mode = models.CharField(blank=True, null=False, default="linear", max_length=8) + show = models.ForeignKey( + "Show", null=False, on_delete=models.CASCADE, related_name="playlists" + ) + updated_at = models.DateTimeField(auto_now=True, blank=True, null=True) + updated_by = models.CharField(blank=True, default="", max_length=150) + class Meta: permissions = [ ("add__file", "Can add file media-source"), @@ -572,6 +582,9 @@ class Playlist(models.Model): ("add__stream", "Can add stream media-source"), ] + def __str__(self): + return f"{self.show.name} - {self.description}" if self.description else self.show.name + class ImageAspectRadioField(models.CharField): validators = [