flask base models

Solutions on MaxInterview for flask base models by the best coders in the world

showing results for - "flask base models"
Fynn
23 Nov 2020
1from flask.ext.sqlalchemy import SQLAlchemy
2db = SQLAlchemy(app)
3
4class Base(db.Model):
5    __abstract__ = True
6
7    created_on = db.Column(db.DateTime, default=db.func.now())
8    updated_on = db.Column(db.DateTime, default=db.func.now(), onupdate=db.func.now())
9
10
11class User(Base):
12    __tablename__ = 'users'
13    id = db.Column(db.Integer, primary_key = True)
14    email = db.Column(db.String(255), unique = True)
15
similar questions
queries leading to this page
flask base models