-
Notifications
You must be signed in to change notification settings - Fork 5
/
models.py
55 lines (42 loc) · 1.44 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from peewee import *
from basemodel import BaseModel
class Site(BaseModel):
shortname = CharField(unique=True, max_length=30)
url = CharField()
name = CharField()
icon_url = CharField()
last_download = DateTimeField(null=True)
tag_background_color = CharField(max_length=7)
tag_foreground_color = CharField(max_length=7)
link_color = CharField(max_length=7)
background_color = CharField(max_length=7, null=True)
foreground_color = CharField(max_length=7, null=True)
primary_color = CharField(max_length=7, null=True)
enabled = BooleanField(default=True)
class Alias(BaseModel):
site = ForeignKeyField(Site)
url = CharField(unique=True, max_length=50)
class Title(BaseModel):
text = CharField()
slug = CharField()
site = ForeignKeyField(Site)
class User(BaseModel):
username = CharField()
site = ForeignKeyField(Site)
class Question(BaseModel):
text = TextField()
upvotes = IntegerField(default=1)
downvotes = IntegerField(default=1)
title = ForeignKeyField(Title)
user = ForeignKeyField(User)
site = ForeignKeyField(Site)
datetime = DateTimeField()
random = IntegerField(null=True)
class Answer(BaseModel):
text = TextField()
upvotes = IntegerField(default=1)
downvotes = IntegerField(default=1)
datetime = DateTimeField()
question = ForeignKeyField(Question, null=True)
user = ForeignKeyField(User)
site = ForeignKeyField(Site)