Switch branches/tags
Nothing to show
Find file Copy path
c26f7d5 Jul 26, 2017
1 contributor

Users who have contributed to this file

17 lines (10 sloc) 411 Bytes
from datetime import datetime
from flask_sse import sse # noqa
from sqlalchemy import Column, DateTime
from flask_sqlalchemy import SQLAlchemy, Model
class BaseModel(Model):
create_at = Column(DateTime, default=datetime.utcnow())
def to_dict(self):
columns = self.__table__.columns.keys()
return {key: getattr(self, key) for key in columns}
db = SQLAlchemy(model_class=BaseModel)