-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
52 lines (39 loc) · 1.27 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
from database import Base
from passlib.hash import pbkdf2_sha256
class Users(Base):
__tablename__ = 'users'
__table_args__ = {'autoload':True}
def __init__(self, username, password):
self.name = username.lower()
self.set_password(password)
def set_password(self, plaintext):
self.pwhash = pbkdf2_sha256.hash(plaintext)
def check_password(self, candidate):
return pbkdf2_sha256.verify(candidate, self.pwhash)
class Games(Base):
__tablename__ = 'games'
__table_args__ = {'autoload':True}
class Players(Base):
__tablename__ = 'players'
__table_args__ = {'autoload':True}
class Missions(Base):
__tablename__ = 'missions'
__table_args__ = {'autoload':True}
class MissionVotes(Base):
__tablename__ = 'mission_votes'
__table_args__ = {'autoload':True}
class Turns(Base):
__tablename__ = 'turns'
__table_args__ = {'autoload':True}
class Nominees(Base):
__tablename__ = 'nominees'
__table_args__ = {'autoload':True}
class TurnVotes(Base):
__tablename__ = 'turn_votes'
__table_args__ = {'autoload':True}
class LeaderOrder(Base):
__tablename__ = 'leader_order'
__table_args__ = {'autoload':True}
class Posts(Base):
__tablename__ = 'posts'
__table_args__ = {'autoload':True}