added user model
This commit is contained in:
parent
1574fb153b
commit
de0ba444e6
3 changed files with 19 additions and 1 deletions
|
@ -1 +1,3 @@
|
||||||
import models
|
import models
|
||||||
|
import utils
|
||||||
|
import user
|
|
@ -1,4 +1,20 @@
|
||||||
from flask.ext.sqlalchemy import SQLAlchemy
|
from flask.ext.sqlalchemy import SQLAlchemy
|
||||||
|
import api.utils
|
||||||
|
|
||||||
db = SQLAlchemy()
|
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
0
server/api/user.py
Normal file
Loading…
Reference in a new issue