mirror of
https://github.com/QualityInUse/lab-random-maksktl.git
synced 2026-08-05 13:35:28 +03:00
Initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import json
|
||||
|
||||
class Task:
|
||||
def __init__(self, task_text, priority, due_date, completed=False):
|
||||
self.task_text = task_text
|
||||
self.priority = priority
|
||||
self.due_date = due_date
|
||||
self.completed = completed
|
||||
|
||||
def mark_completed(self):
|
||||
self.completed = True
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
"task_text": self.task_text,
|
||||
"priority": self.priority,
|
||||
"due_date": self.due_date,
|
||||
"completed": self.completed
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def from_dict(task_data):
|
||||
return Task(
|
||||
task_data['task_text'],
|
||||
task_data['priority'],
|
||||
task_data['due_date'],
|
||||
task_data['completed']
|
||||
)
|
||||
Reference in New Issue
Block a user