def homePage(): recent_items = db.query(Item).order_by(desc(Item.time_created)).limit(10) # Retrieve categories from class heirarchy rather than the database to # account for cases when all items in a category are deleted categories = [cls.__name__ for cls in Item.__subclasses__()] return render_template("index.html", items=recent_items, categories=categories)