def category_photo(category_id): category = Category.get_by_id(category_id) if not category.photo: return "error", 500 return send_file(io.BytesIO(category.photo), attachment_filename='category_photo.png', mimetype=category.photo_mimetype)
def browse(category_id): if not session.get("logged_in"): return login() items = Item.query(Item.category == category_id, Item.sold == False) for item in items: item.item_id = item.key.id() notifications = Notification.query( Notification.user == session["user_id"]).order(-Notification.time) category = Category.get_by_id(category_id) return render_template("browse.html", items=items, category=category, category_id=category_id, notifications=notifications)