-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
36 lines (30 loc) · 890 Bytes
/
model.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
from peewee import *
db = SqliteDatabase('course.db', check_same_thread=True)
class BaseModel(Model):
class Meta:
database = db
class GradeData(BaseModel):
semester = CharField(4)
course_no = TextField()
course_name = TextField()
grades = TextField()
total = IntegerField()
type = BooleanField()
GPA = DoubleField()
class Meta:
indexes = (
(('semester', 'course_no'), True),
)
class CourseData(BaseModel):
semester = CharField(4)
course_no = TextField()
course_name = TextField()
credit = DoubleField()
node = TextField(null=True)
dimension = CharField(1, null=True)
lecturer = TextField(null=True)
grade_data = ForeignKeyField(GradeData, backref='course_data', null=True, default=None)
class Meta:
indexes = (
(('semester', 'course_no'), True),
)