Skip to content

Instantly share code, notes, and snippets.

@Deviad
Created May 29, 2017 18:25
Show Gist options
  • Save Deviad/27599e29d7f56ad08b9df21442b856b1 to your computer and use it in GitHub Desktop.
Save Deviad/27599e29d7f56ad08b9df21442b856b1 to your computer and use it in GitHub Desktop.
models of my flask app
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