Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,6 +64,9 @@ def generate_coupon_code(length=10):
|
|
| 64 |
characters = string.ascii_uppercase + string.digits # A-Z, 0-9
|
| 65 |
return ''.join(random.choice(characters) for _ in range(length))
|
| 66 |
|
|
|
|
|
|
|
|
|
|
| 67 |
@app.route("/generate_custom_dish", methods=["POST"])
|
| 68 |
def generate_custom_dish():
|
| 69 |
try:
|
|
@@ -85,7 +88,7 @@ def generate_custom_dish():
|
|
| 85 |
"Non-Veg" if any(word in description.lower() for word in non_veg_keywords) else \
|
| 86 |
"Both"
|
| 87 |
|
| 88 |
-
# Store in the custom dishes list
|
| 89 |
custom_dish = {
|
| 90 |
"Name": dish_name,
|
| 91 |
"Price__c": price,
|
|
@@ -95,13 +98,14 @@ def generate_custom_dish():
|
|
| 95 |
"Total_Ordered__c": 0
|
| 96 |
}
|
| 97 |
|
| 98 |
-
custom_dishes.append(custom_dish) # Store in
|
| 99 |
|
| 100 |
return redirect(url_for("menu", category="Customized Dish")) # Redirect back to the menu with custom dish
|
| 101 |
|
| 102 |
except Exception as e:
|
| 103 |
return jsonify({"success": False, "error": str(e)}), 500
|
| 104 |
|
|
|
|
| 105 |
import re
|
| 106 |
@app.route("/edit_profile", methods=["GET", "POST"])
|
| 107 |
def edit_profile():
|
|
|
|
| 64 |
characters = string.ascii_uppercase + string.digits # A-Z, 0-9
|
| 65 |
return ''.join(random.choice(characters) for _ in range(length))
|
| 66 |
|
| 67 |
+
# Define custom_dishes as a global variable
|
| 68 |
+
custom_dishes = []
|
| 69 |
+
|
| 70 |
@app.route("/generate_custom_dish", methods=["POST"])
|
| 71 |
def generate_custom_dish():
|
| 72 |
try:
|
|
|
|
| 88 |
"Non-Veg" if any(word in description.lower() for word in non_veg_keywords) else \
|
| 89 |
"Both"
|
| 90 |
|
| 91 |
+
# Store in the custom dishes list
|
| 92 |
custom_dish = {
|
| 93 |
"Name": dish_name,
|
| 94 |
"Price__c": price,
|
|
|
|
| 98 |
"Total_Ordered__c": 0
|
| 99 |
}
|
| 100 |
|
| 101 |
+
custom_dishes.append(custom_dish) # Store in the list
|
| 102 |
|
| 103 |
return redirect(url_for("menu", category="Customized Dish")) # Redirect back to the menu with custom dish
|
| 104 |
|
| 105 |
except Exception as e:
|
| 106 |
return jsonify({"success": False, "error": str(e)}), 500
|
| 107 |
|
| 108 |
+
|
| 109 |
import re
|
| 110 |
@app.route("/edit_profile", methods=["GET", "POST"])
|
| 111 |
def edit_profile():
|