save all the course json date to database
This commit is contained in:
@@ -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})"
|
||||
|
||||
|
||||
# 使用示例
|
||||
|
||||
Reference in New Issue
Block a user