-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
37 lines (28 loc) · 877 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from peewee import *
from database import DatabaseConnection
class BaseModel(Model):
class Meta:
database = DatabaseConnection.db
class Board(BaseModel):
board_title = CharField()
board_id = IntegerField(null=True, default=None)
class Status(BaseModel):
name = CharField()
status_list = [
{"name": "not_yet_arranged"},
{"name": "new"},
{"name": "in_progress"},
{"name": "review"},
{"name": "done"}
]
@staticmethod
def gen_status():
for status in Status.status_list:
Status.create(name=status["name"])
class Cards(BaseModel):
card_title = CharField()
card_desc = CharField()
card_id = IntegerField()
board = ForeignKeyField(Board, null=True, default=None)
status = ForeignKeyField(Status, null=True, default=None)
background_color = CharField()