added user model

This commit is contained in:
Michael Zhang 2015-12-23 17:06:44 -06:00
parent 1574fb153b
commit de0ba444e6
3 changed files with 19 additions and 1 deletions

View file

@ -1 +1,3 @@
import models
import utils
import user

View file

@ -1,4 +1,20 @@
from flask.ext.sqlalchemy import SQLAlchemy
import api.utils
db = SQLAlchemy()
class Users(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64))
username = db.Column(db.String(64), unique=True)
username_lower = db.Column(db.String(64), unique=True)
email = db.Column(db.String(64), unique=True)
password = db.Column(db.String(128))
admin = db.Column(db.Boolean)
def __init__(self, name, username, email, password):
self.name = name
self.username = username
self.username_lower = username.lower()
self.email = email.lower()
self.password = api.utils.hash_password(password)

0
server/api/user.py Normal file
View file