-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathmodels.py
33 lines (24 loc) · 812 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
33
# -*- encoding: utf-8 -*-
"""
License: MIT
Copyright (c) 2019 - present AppSeed.us
"""
from app import db
from flask_login import UserMixin
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)
user = db.Column(db.String(64), unique = True)
email = db.Column(db.String(120), unique = True)
password = db.Column(db.String(500))
def __init__(self, user, email, password):
self.user = user
self.password = password
self.email = email
def __repr__(self):
return str(self.id) + ' - ' + str(self.user)
def save(self):
# inject self into db session
db.session.add ( self )
# commit change and save the object
db.session.commit( )
return self