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

feat: add Playlist model

parent e57f5f2e
No related branches found
No related tags found
1 merge request!59Add playlists
# 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",
),
]
# 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"),
],
},
),
]
......@@ -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 = [
......
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