diff --git a/service.py b/service.py index ab2fdbb..ebec19f 100644 --- a/service.py +++ b/service.py @@ -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) diff --git a/templates/recentlyuploaded.html b/templates/recentlyuploaded.html new file mode 100644 index 0000000..84b64ca --- /dev/null +++ b/templates/recentlyuploaded.html @@ -0,0 +1,18 @@ +{% extends "template.html" %} +{% block content %} + {% if articles%} + + + + + + + {% for article in articles %} + + + + + {% endfor %} +
subjecttitletime
{{ article.subject.name }}{{ article.title }}{{ article.time.strftime("%Y-%m-%d %H:%M") }}
+ {% endif %} +{% endblock %} \ No newline at end of file diff --git a/templates/template.html b/templates/template.html index 662c63c..b7b0cd2 100644 --- a/templates/template.html +++ b/templates/template.html @@ -48,7 +48,10 @@ + +