Example #1
0
def index():
    categories = Forum.get_categories().all()

    # Fetch a few stats about the forum
    user_count = User.query.count()
    topic_count = Topic.query.count()
    post_count = Post.query.count()
    newest_user = User.query.order_by(User.id.desc()).first()

    return render_template("forum/index.html", categories=categories,
                           user_count=user_count,
                           topic_count=topic_count,
                           post_count=post_count,
                           newest_user=newest_user,
                           online_users=len(get_online_users()),
                           online_guests=len(get_online_users(guest=True)))
Example #2
0
def who_is_online():
    return render_template("forum/online_users.html",
                           online_users=get_online_users())