zkt21/sk1/web/models.py
2021-05-24 19:48:55 +02:00

19 lines
364 B
Python

# 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()