INNER CODE UNIT · Python

create_collection

AnsahMohammad/shots-studio · legacy/web/app.py:160

def create_collection():
    global collections
    data = request.json
    name = data.get("name")
    description = data.get("description", "")

    if not name:
        return jsonify({"success": False, "error": "Name is required"}), 400

    # Check if collection with this name already exists
    if any(c.name == name for c in collections):
        return jsonify({"success": False, "error": "Collection already exists"}), 400

    # Create new collection
    collection = Collection(name)
    collection.set_description(description)
    collections.append(collection)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…