Fix du problème de date différente au post initial

La date de publication et la date de modification n'étaient pas les
mêmes lors de la création du message.
This commit is contained in:
Eragon 2019-12-05 11:40:28 +01:00
parent ab03daf527
commit 9da11b62ca
No known key found for this signature in database
GPG Key ID: 41F8C3FE5948FDAB
1 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@ from app import db
from app.models.users import User
from datetime import datetime
class Post(db.Model):
"""Contents created and published by Users."""
@ -18,7 +19,7 @@ class Post(db.Model):
# Post author
author_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
author = db.relationship('User', backref="posts",foreign_keys=author_id)
author = db.relationship('User', backref="posts", foreign_keys=author_id)
# TODO: Post attachments?
@ -37,7 +38,7 @@ class Post(db.Model):
self.author = author
self.date_created = datetime.now()
self.date_modified = datetime.now()
self.date_modified = self.date_created
def touch(self):
"""Touch a Post when it is edited."""