Add new users list to index

This commit is contained in:
Xevion
2022-03-27 11:18:46 -05:00
parent b70e39acfa
commit 0ade256bc9
2 changed files with 10 additions and 2 deletions

View File

@@ -8,7 +8,8 @@ blueprint = Blueprint('main', __name__)
@blueprint.route('/')
def index(): # put application's code here
return render_template('layouts/index.html')
users = User.query.order_by(User.time_registered).limit(10).all()
return render_template('layouts/index.html', new_users=users)
@blueprint.route('/about')

View File

@@ -1,5 +1,12 @@
{% extends 'layouts/base.html' %}
{% block content %}
<h4>New Users</h4>
<h2>New Users</h2>
<div style="border: 1px solid grey; padding: 0.2em; width: fit-content; padding-right: 1.2em;">
<ul>
{% for new_user in new_users %}
<li><a href="{{ url_for('main.user', username=new_user.username) }}" style="text-decoration: none">{{ new_user.username }}</a> as of {{ new_user.get_registration_delta() }} ago</li>
{% endfor %}
</ul>
</div>
{% endblock %}