Created
May 29, 2017 18:25
-
-
Save Deviad/27599e29d7f56ad08b9df21442b856b1 to your computer and use it in GitHub Desktop.
models of my flask app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask_sqlalchemy import SQLAlchemy | |
app = Flask(__name__) | |
app.config.from_object('config.DevelopmentConfig') | |
db = SQLAlchemy(app) | |
class User(db.Model): | |
__tablename__ = 'users' | |
id = db.Column(db.Integer, primary_key=True) | |
email = db.Column(db.String(255), unique=True, nullable=False) | |
password = db.Column(db.String(255), unique=True, nullable=False) | |
def __init__(self, email, password): | |
self.email = email | |
self.password = password | |
def __repr__(self): | |
return "<User (email='%r', password='%r')>" % (self.email, self.password) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment