Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions service.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,11 @@ def author(author_id):
comments = Comment.query.order_by(Comment.time.desc()).filter_by(author_id=author_id).all()
return render_template('author.html', articles=articles, comments=comments, Tool=Tool)

@app.route('/recent')
def sort_articles():
articles = Article.query.order_by(Article.time.desc()).all()
return render_template("recentlyuploaded.html", articles=articles)

if __name__ == '__main__':
app.run(debug=True)

Expand Down
18 changes: 18 additions & 0 deletions templates/recentlyuploaded.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends "template.html" %}
{% block content %}
{% if articles%}
<table class="table table-hover table-striped">
<tr>
<th>subject</th>
<th>title</th>
<th>time</th>
</tr>
{% for article in articles %}
<td><a href="/subject/{{ article.subject_id }}">{{ article.subject.name }}</a></td>
<td><a href="/article/{{ article.id }}">{{ article.title }}</a></td>
<td>{{ article.time.strftime("%Y-%m-%d %H:%M") }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}
5 changes: 4 additions & 1 deletion templates/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@
</li>
<li class="nav-item">
<a class="nav-link" href="/donation">Donation</a>
</li>
</li>
<li class="nav-item">
<a class="nav-link" href="/recent">Recent articles</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/admin">admin</a>
</li>
Expand Down