def index(): categories = Category.get_all(user=current_user) # 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() # online_users = len(get_online_users()) # online_guests = len(get_online_users(guest=True)) return render_template("forum/forum/index.html", categories=categories, user_count=user_count, topic_count=topic_count, post_count=post_count, newest_user=newest_user)
def index(): categories = Category.get_all(user=current_user) print categories # 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() # online_users = len(get_online_users()) # online_guests = len(get_online_users(guest=True)) return render_template("forum/forum/index.html", categories=categories, user_count=user_count, topic_count=topic_count, post_count=post_count, newest_user=newest_user)
def save(self): data = self.data data.pop('submit', None) category = Category(**data) return category.save()