INNER CODE UNIT · Python
view_collection
AnsahMohammad/shots-studio · legacy/web/app.py:203
def view_collection(name):
collection = next((c for c in collections if c.name == name), None)
if not collection:
return "Collection not found", 404
return render_template("collection.html", collection=collection)
@app.route("/image/<path:filename>/update_collections", methods=["POST"])
def update_image_collections(filename):
data = request.json
collection_names = data.get("collections", [])
img_name = os.path.basename(filename)
image = next((img for img in images if img.filename == img_name), None)
if not image:
return jsonify({"error": "Image not found"}), 404