mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-10-06 22:32:41 +07:00
feat: The correct way to get/post chapters in django
This commit is contained in:
@@ -18,8 +18,13 @@ class VideoChapterData(models.Model):
|
||||
data = []
|
||||
if self.data and isinstance(self.data, list):
|
||||
for item in self.data:
|
||||
if item.get("startTime") and item.get("endTime") and item.get("text"):
|
||||
data.append(item)
|
||||
if item.get("startTime") and item.get("endTime") and item.get("chapterTitle"):
|
||||
chapter_item = {
|
||||
'startTime': item.get("startTime"),
|
||||
'endTime': item.get("endTime"),
|
||||
'chapterTitle': item.get("chapterTitle"),
|
||||
}
|
||||
data.append(chapter_item)
|
||||
return data
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user