forked from lalor/todolist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
32 lines (25 loc) · 938 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
#!/usr/bin/python
#-*- coding: UTF-8 -*-
import time
from ext import db
from flask_login import UserMixin
class TodoList(db.Model):
__tablename__ = 'todolist'
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, nullable=False)
title = db.Column(db.String(1024), nullable=False)
status = db.Column(db.Integer, nullable=False)
create_time = db.Column(db.Integer, nullable=False)
def __init__(self, user_id, title, status):
self.user_id = user_id
self.title = title
self.status = status
self.create_time = time.time()
class User(UserMixin, db.Model):
__tablename__ = "user"
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(24), nullable=False)
password = db.Column(db.String(24), nullable=False)
def __init__(self, username, password):
self.username = username
self.password = password