I'm creating a blog in Flask but I'm getting an issue while creating blog posts. I always get this error:
SQLite DateTime type only accepts Python datetime and date objects as input.
It's showing the error as coming from my models.py file.
Here is my models.py file:
class Post(db.Model):
__tablename__ = 'posts'
id = db.Column(db.Integer,primary_key = True)
title = db.Column(db.String(50),)
time = db.Column(db.DateTime,nullable=False,default=str(datetime.datetime.now().strftime("%a, %b %d, %Y")))
description = db.Column(db.Text,)
user_id = db.Column(db.Integer,db.ForeignKey('users.id'))
def __init__(self,title,description,user_id):
self.title = title
self.description = description
self.user_id = user_id