Simple pagination for /activity-history

This commit is contained in:
richard-dds
2018-11-12 15:33:33 -05:00
parent c3e395753c
commit 5b0383bde3
2 changed files with 17 additions and 1 deletions

View File

@@ -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)