How to sort posts by date (FLASK, PYTHON, SQLALCHEMY)

Solution
def home():
    title = Post.query.get("title")
    date = Post.query.get("date")
    # images below are list of strings
    images = os.listdir(os.path.join(staticpath, "uploads"))
    # images below is a collection of `Post` instances (and it is sorted)
    images = Post.query.filter(Post.name.in_(images)).order_by(Post.date)
    return render_template('home.html', images=images, user=current_user, title=title, date=date, Post=Post, User=User)

{% extends "base.html" %}
{% block title %}home{% endblock %}
{% block content %}

{% for image in images %}

title: {{ image.title }}

date: {{ image.date }}

OP ID: {{ image.user_id }}

{{ image }}

{% endfor %}
{% endblock %}