save all the course json date to database

This commit is contained in:
lostecho
2024-05-26 19:35:57 +08:00
parent 6e4c28fb76
commit b7d1f71575
6 changed files with 175 additions and 6 deletions

View File

@@ -2,16 +2,23 @@ from courses.Attachment import Attachment
class Course:
def __init__(self, course_id, title, attachments=None):
id: None
title: ""
description: ""
duration: 0
attachments: []
def __init__(self, course_id, title, description, attachments=None):
self.id = course_id
self.title = title
self.description = description
self.attachments = attachments if attachments else []
def add_attachment(self, attachment):
self.attachments.append(attachment)
def __repr__(self):
return f"Course(id={self.id}, title={self.title}, attachments={self.attachments})"
return f"Course(id={self.id}, title={self.title}, description={self.description}, attachments={self.attachments})"
# 使用示例