19 lines
364 B
Python
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()
|