towards njp.ma
This commit is contained in:
parent
a7c48d557d
commit
b24ba91bfc
23 changed files with 167 additions and 524 deletions
|
|
@ -20,8 +20,7 @@ class Film(models.Model):
|
|||
public = models.BooleanField(default=False)
|
||||
position = models.IntegerField(default=0)
|
||||
|
||||
padma_id = models.CharField(max_length=255)
|
||||
vimeo_id = models.CharField(max_length=255, default=None, blank=True, null=True)
|
||||
pandora_url = models.CharField(max_length=1024)
|
||||
|
||||
data = models.JSONField(default=dict, blank=True)
|
||||
|
||||
|
|
@ -33,7 +32,9 @@ class Film(models.Model):
|
|||
|
||||
def related_texts(self):
|
||||
from ..text.models import Text
|
||||
return Text.objects.filter(Q(data__item=self.padma_id) | Q(data__related=self.padma_id))
|
||||
folder = self.data.get('title')
|
||||
if folder:
|
||||
return Text.objects.filter(Q(data__folder=folder) | Q(data__related=folder))
|
||||
|
||||
def duration(self):
|
||||
return ox.format_duration(self.data['duration'] * 1000, verbosity=1, milliseconds=False)
|
||||
|
|
@ -68,23 +69,8 @@ class Film(models.Model):
|
|||
|
||||
def json(self):
|
||||
data = {}
|
||||
data['id'] = self.padma_id
|
||||
data['url'] = self.pandora_url
|
||||
#data.update(self.data)
|
||||
return json.dumps(data)
|
||||
|
||||
|
||||
class Edit(models.Model):
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
modified = models.DateTimeField(auto_now=True)
|
||||
|
||||
slug = models.SlugField()
|
||||
public = models.BooleanField(default=False)
|
||||
|
||||
padma_id = models.CharField(max_length=1024)
|
||||
annotation_user = models.CharField(max_length=1024)
|
||||
vimeo_id = models.CharField(max_length=255, default=None, null=True)
|
||||
|
||||
data = models.JSONField(default=dict, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.data.get('title', self.slug)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue