-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
49 lines (42 loc) · 1.58 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
# coding=utf-8
"""
Models
"""
# noinspection PyUnresolvedReferences
from app import db
import datetime
from flask_login import UserMixin
class User(UserMixin, db.Model):
"""
class User
"""
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(115), unique=True)
email = db.Column(db.String(115), unique=True)
password = db.Column(db.String(120))
is_admin = db.Column(db.Boolean, default=False)
verified = db.Column(db.Boolean, default=False)
manual = db.Column(db.Boolean, default=False)
# account = db.Column(db.relationship('Account', backref='user', lazy='dynamic'))
# history = db.Column(db.relationship('History', backref='user', lazy='dynamic'))
class Account(db.Model):
"""
class Account
"""
id = db.Column(db.Integer, primary_key=True)
plan = db.Column(db.String(100), default=None)
sub_date = db.Column(db.DateTime, default=datetime.datetime.now())
due_date = db.Column(db.DateTime, default=datetime.datetime.now())
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
verified = db.Column(db.Boolean, default=False)
reference = db.Column(db.String(100), default='')
manual = db.Column(db.Boolean, default=False)
class History(db.Model):
"""
class History
"""
id = db.Column(db.Integer, primary_key=True)
plan = db.Column(db.String(100), default=None)
sub_date = db.Column(db.DateTime, default=datetime.datetime.now())
due_date = db.Column(db.DateTime, default=datetime.datetime.now())
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))