Merge branch 'dev' of gitea.planet-casio.com:devs/PCv5 into dev

This commit is contained in:
Darks 2019-12-05 23:08:54 +01:00
commit 94badf4bad
Signed by: Darks
GPG Key ID: F61F10FA138E797C
2 changed files with 11 additions and 4 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."""

View File

@ -13,14 +13,20 @@
<td class="member">{{ widget_member.profile(t.author ) }}</td>
<td>{{ t.thread.top_comment.text }}</td>
</tr></table>
<hr>
<table class="thread">
{% for i, c in enumerate(t.thread.comments) %}
<tr>
{% if c != t.thread.top_comment %}
<td class="member">{{ widget_member.profile(c.author ) }}</td>
<td>{{ c.text }}
<td>
{% if c.date_created != c.date_modified %}
Le {{ c.date_created|date }} (Modifié le {{ c.date_modified|date }})
{% elif c.date_created == c.date_modified %}
Le {{ c.date_created|date }}
{% endif %}
<hr>
<p>{{ c.text }}</p>
{% elif i != 0 %}
<div>Ce message est le top comment</div>
{% endif %}