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