mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 19:10:00 +00:00
Added date column t o comments
This commit is contained in:
parent
fe6abf33c1
commit
c3a637c8eb
|
@ -325,6 +325,7 @@ class Comment(db.Model):
|
|||
DB_TABLE_PREFIX + 'torrents.id'), primary_key=True)
|
||||
user_id = db.Column(db.Integer, db.ForeignKey(
|
||||
'users.id', ondelete='CASCADE'))
|
||||
created_time = db.Column(db.DateTime(timezone=False), default=datetime.utcnow)
|
||||
text = db.Column(db.String(length=255), nullable=False)
|
||||
|
||||
user = db.relationship('User', uselist=False, back_populates='comments')
|
||||
|
@ -332,6 +333,11 @@ class Comment(db.Model):
|
|||
def __repr__(self):
|
||||
return '<Comment %r>' % self.id
|
||||
|
||||
@property
|
||||
def created_utc_timestamp(self):
|
||||
''' Returns a UTC POSIX timestamp, as seconds '''
|
||||
return (self.created_time - UTC_EPOCH).total_seconds()
|
||||
|
||||
|
||||
class UserLevelType(IntEnum):
|
||||
REGULAR = 0
|
||||
|
|
|
@ -142,6 +142,7 @@
|
|||
{% if g.user.is_admin %}
|
||||
<th style="width:auto;">Delete</th>
|
||||
{% endif %}
|
||||
<th style="width:auto;">Date</th>
|
||||
<th style="width:auto;">User</th>
|
||||
<th style="width:100%;">Comment</th>
|
||||
</thead>
|
||||
|
@ -162,7 +163,8 @@
|
|||
<span>Anonymous</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="col-md-10">{{ comment.text }}</td>
|
||||
<td class="col-md-1" data-timestamp="{{ torrent.created_utc_timestamp|int }}">{{ torrent.created_time.strftime('%Y-%m-%d %H:%M UTC') }}</td>
|
||||
<td class="col-md-9">{{ comment.text }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tbody>
|
||||
|
|
Loading…
Reference in a new issue