37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import uuid
|
|
from django.db import models
|
|
from . import odysee
|
|
|
|
class Tag(models.Model):
|
|
id = models.CharField(primary_key=True, max_length=512, default=uuid.uuid4, editable=False, db_index=True)
|
|
name = models.CharField(max_length=256)
|
|
description = models.TextField()
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
class OdyseeChannel(models.Model):
|
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, db_index=True)
|
|
name = models.CharField(max_length=1024)
|
|
description = models.TextField()
|
|
|
|
handle = models.CharField(max_length=1024)
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
class OdyseeRelease(models.Model):
|
|
id = models.CharField(primary_key=True, max_length=512, default=uuid.uuid4, editable=False, db_index=True)
|
|
channel = models.ForeignKey(OdyseeChannel, on_delete=models.CASCADE, db_index=True)
|
|
name = models.CharField(max_length=1024)
|
|
description = models.TextField()
|
|
released = models.DateField()
|
|
url = models.URLField(max_length=512)
|
|
thumbnail = models.URLField(max_length=512)
|
|
filehash = models.CharField(max_length=512)
|
|
|
|
tags = models.ManyToManyField(Tag)
|
|
|
|
def __str__(self):
|
|
return self.name
|