zkt21/z2/web/models.py

19 lines
364 B
Python
Raw Permalink Normal View History

2021-04-18 11:21:46 +00:00
# models.py
import datetime
from app import db
class Post(db.Model):
__tablename__ = 'posts'
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.String, nullable=False)
date_posted = db.Column(db.DateTime, nullable=False)
def __init__(self, text):
self.text = text
self.date_posted = datetime.datetime.now()