<reponame>rubyleehs/FlaskMVC_Template
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()

class Todo(db.Model):
    __tablename__ = 'todos'
    id = db.Column(db.Integer, primary_key = True)
    content = db.Column(db.String(200), nullable=False)
    date_created = db.Column(db.DateTime, default = datetime.utcnow)
    
    @property
    def serialize(self):
        return {
            'id': self.id,
            'content': self.content,
            'date_created': self.date_created
        }
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()

class Todo(db.Model):
    __tablename__ = 'todos'
    id = db.Column(db.Integer, primary_key = True)
    content = db.Column(db.String(200), nullable=False)
    date_created = db.Column(db.DateTime, default = datetime.utcnow)
    
    @property
    def serialize(self):
        return {
            'id': self.id,
            'content': self.content,
            'date_created': self.date_created
        }