add basic database functionality #9
@@ -6,7 +6,7 @@ from dataclasses import dataclass, fields
|
||||
@dataclass
|
||||
class Task:
|
||||
title: str
|
||||
done: bool
|
||||
is_done: bool
|
||||
def __post_init__(self):
|
||||
for field in fields(self):
|
||||
if field.type is bool:
|
||||
@@ -22,7 +22,7 @@ class Database:
|
||||
self.initialize_table()
|
||||
|
||||
def initialize_table(self):
|
||||
self.cur.execute("CREATE TABLE tasks(title TEXT, done INTEGER)")
|
||||
self.cur.execute("CREATE TABLE tasks(title TEXT, is_done INTEGER)")
|
||||
|
||||
|
||||
def create_task(self, title: str, done:bool=False) -> None:
|
||||
|
||||
Reference in New Issue
Block a user