also include related

This commit is contained in:
j 2021-10-22 17:15:06 +01:00
parent 81e6770867
commit e5195da141

View file

@ -4,6 +4,7 @@ import json
from django.conf import settings from django.conf import settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.db import models from django.db import models
from django.db.models import Q
import ox import ox
@ -32,7 +33,7 @@ class Film(models.Model):
def related_texts(self): def related_texts(self):
from ..text.models import Text from ..text.models import Text
return Text.objects.filter(data__item=self.padma_id) return Text.objects.filter(Q(data__item=self.padma_id) | Q(data__related=self.padma_id))
def duration(self): def duration(self):
return ox.format_duration(self.data['duration'] * 1000, verbosity=1, milliseconds=False) return ox.format_duration(self.data['duration'] * 1000, verbosity=1, milliseconds=False)