zkt21/sk1/web/models.py

19 lines
364 B
Python
Raw Permalink Normal View History

2021-05-24 17:48:55 +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()