Simple pagination for /activity-history
This commit is contained in:
parent
c3e395753c
commit
5b0383bde3
@ -121,9 +121,17 @@ def logout():
|
||||
return redirect(url_for(".root"))
|
||||
|
||||
|
||||
def pagination_info(request, default_page=1, default_per_page=50):
|
||||
return {
|
||||
"page": int(request.args.get("page", default_page)),
|
||||
"per_page": int(request.args.get("per_page", default_per_page)),
|
||||
}
|
||||
|
||||
|
||||
@bp.route("/activity-history")
|
||||
def activity_history():
|
||||
audit_events = AuditLog.get_all_events(g.current_user)
|
||||
pagination = pagination_info(request)
|
||||
audit_events = AuditLog.get_all_events(g.current_user, pagination)
|
||||
return render_template("audit_log.html", audit_events=audit_events)
|
||||
|
||||
|
||||
|
@ -40,5 +40,13 @@
|
||||
|
||||
</section>
|
||||
|
||||
{% for i in range(1, audit_events.pages + 1) %}
|
||||
{% if i == audit_events.page %}
|
||||
{{ i }}
|
||||
{% else %}
|
||||
<a href="{{ url_for('atst.activity_history', page=i) }}">{{ i }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user