chore(api): rename playlist models fields
This commit is contained in:
parent
7c613d9176
commit
1c48f11af2
2 changed files with 87 additions and 62 deletions
|
@ -2,20 +2,23 @@ from django.db import models
|
|||
|
||||
|
||||
class Playlist(models.Model):
|
||||
created_at = models.DateTimeField(blank=True, null=True, db_column="utime")
|
||||
updated_at = models.DateTimeField(blank=True, null=True, db_column="mtime")
|
||||
|
||||
name = models.CharField(max_length=255)
|
||||
mtime = models.DateTimeField(blank=True, null=True)
|
||||
utime = models.DateTimeField(blank=True, null=True)
|
||||
creator = models.ForeignKey(
|
||||
description = models.CharField(max_length=512, blank=True, null=True)
|
||||
length = models.DurationField(blank=True, null=True)
|
||||
|
||||
owner = models.ForeignKey(
|
||||
"core.User",
|
||||
on_delete=models.DO_NOTHING,
|
||||
blank=True,
|
||||
null=True,
|
||||
db_column="creator_id",
|
||||
)
|
||||
description = models.CharField(max_length=512, blank=True, null=True)
|
||||
length = models.DurationField(blank=True, null=True)
|
||||
|
||||
def get_owner(self):
|
||||
return self.creator
|
||||
return self.owner
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
|
@ -29,27 +32,43 @@ class PlaylistContent(models.Model):
|
|||
blank=True,
|
||||
null=True,
|
||||
)
|
||||
|
||||
class Kind(models.IntegerChoices):
|
||||
FILE = 0, "File"
|
||||
STREAM = 1, "Stream"
|
||||
BLOCK = 2, "Block"
|
||||
|
||||
kind = models.SmallIntegerField(
|
||||
choices=Kind.choices,
|
||||
db_column="type",
|
||||
)
|
||||
|
||||
file = models.ForeignKey(
|
||||
"storage.File",
|
||||
on_delete=models.DO_NOTHING,
|
||||
blank=True,
|
||||
null=True,
|
||||
)
|
||||
stream = models.ForeignKey(
|
||||
"schedule.Webstream",
|
||||
on_delete=models.DO_NOTHING,
|
||||
blank=True,
|
||||
null=True,
|
||||
)
|
||||
block = models.ForeignKey(
|
||||
"schedule.SmartBlock",
|
||||
on_delete=models.DO_NOTHING,
|
||||
blank=True,
|
||||
null=True,
|
||||
)
|
||||
stream_id = models.IntegerField(blank=True, null=True)
|
||||
type = models.SmallIntegerField()
|
||||
|
||||
position = models.IntegerField(blank=True, null=True)
|
||||
trackoffset = models.FloatField()
|
||||
cliplength = models.DurationField(blank=True, null=True)
|
||||
cuein = models.DurationField(blank=True, null=True)
|
||||
cueout = models.DurationField(blank=True, null=True)
|
||||
fadein = models.TimeField(blank=True, null=True)
|
||||
fadeout = models.TimeField(blank=True, null=True)
|
||||
offset = models.FloatField(db_column="trackoffset")
|
||||
length = models.DurationField(blank=True, null=True, db_column="cliplength")
|
||||
cue_in = models.DurationField(blank=True, null=True, db_column="cuein")
|
||||
cue_out = models.DurationField(blank=True, null=True, db_column="cueout")
|
||||
fade_in = models.TimeField(blank=True, null=True, db_column="fadein")
|
||||
fade_out = models.TimeField(blank=True, null=True, db_column="fadeout")
|
||||
|
||||
def get_owner(self):
|
||||
return self.playlist.get_owner()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue