Spaces:
Runtime error
Runtime error
Update app/orderhistory.py
Browse files- app/orderhistory.py +5 -7
app/orderhistory.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
-
from flask import
|
| 2 |
-
from flask_session import Session # Import the Session class
|
| 3 |
-
from flask.sessions import SecureCookieSessionInterface # Import the class
|
| 4 |
-
|
| 5 |
from datetime import datetime
|
| 6 |
import pytz # Library to handle timezone conversions
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
def order_history():
|
| 10 |
email = session.get('user_email') # Get logged-in user's email
|
| 11 |
if not email:
|
|
@@ -62,10 +62,8 @@ def order_history():
|
|
| 62 |
order_status = order.get("Order_Status__c", "N/A") # Default to "N/A" if no status
|
| 63 |
order['order_status'] = order_status
|
| 64 |
|
| 65 |
-
|
| 66 |
return render_template("order_history.html", orders=orders)
|
| 67 |
|
| 68 |
except Exception as e:
|
| 69 |
print(f"Error fetching order history: {str(e)}")
|
| 70 |
return render_template("order_history.html", orders=[], error=str(e))
|
| 71 |
-
|
|
|
|
| 1 |
+
from flask import Blueprint, render_template, request, jsonify, redirect, url_for, session
|
|
|
|
|
|
|
|
|
|
| 2 |
from datetime import datetime
|
| 3 |
import pytz # Library to handle timezone conversions
|
| 4 |
|
| 5 |
+
# Create the Blueprint for order history
|
| 6 |
+
orderhistory_bp = Blueprint('orderhistory', __name__)
|
| 7 |
+
|
| 8 |
+
@orderhistory_bp.route("/order-history", methods=["GET"])
|
| 9 |
def order_history():
|
| 10 |
email = session.get('user_email') # Get logged-in user's email
|
| 11 |
if not email:
|
|
|
|
| 62 |
order_status = order.get("Order_Status__c", "N/A") # Default to "N/A" if no status
|
| 63 |
order['order_status'] = order_status
|
| 64 |
|
|
|
|
| 65 |
return render_template("order_history.html", orders=orders)
|
| 66 |
|
| 67 |
except Exception as e:
|
| 68 |
print(f"Error fetching order history: {str(e)}")
|
| 69 |
return render_template("order_history.html", orders=[], error=str(e))
|
|
|