feat: The correct way to get/post chapters in django

This commit is contained in:
Yiannis Christodoulou
2025-09-19 12:05:46 +03:00
parent b96134bd9f
commit 0456051a11
3 changed files with 19 additions and 8 deletions
+7 -2
View File
@@ -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