nagasurendra commited on
Commit
dc5e8d2
·
verified ·
1 Parent(s): 049ac53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -50,6 +50,8 @@ def generate_coupon_code(length=10):
50
  return ''.join(random.choice(characters) for _ in range(length))
51
 
52
 
 
 
53
  @app.route("/order-history", methods=["GET"])
54
  def order_history():
55
  email = session.get('user_email') # Get logged-in user's email
@@ -68,6 +70,12 @@ def order_history():
68
 
69
  orders = result.get("records", []) # Fetch all orders
70
 
 
 
 
 
 
 
71
  return render_template("order_history.html", orders=orders)
72
 
73
  except Exception as e:
@@ -77,6 +85,7 @@ def order_history():
77
 
78
 
79
 
 
80
  @app.route("/signup", methods=["GET", "POST"])
81
  def signup():
82
  if request.method == "POST":
 
50
  return ''.join(random.choice(characters) for _ in range(length))
51
 
52
 
53
+ import re
54
+
55
  @app.route("/order-history", methods=["GET"])
56
  def order_history():
57
  email = session.get('user_email') # Get logged-in user's email
 
70
 
71
  orders = result.get("records", []) # Fetch all orders
72
 
73
+ # Strip image URLs from order details
74
+ for order in orders:
75
+ order_details = order.get("Order_Details__c", "")
76
+ # Remove image URLs using regex
77
+ order['Order_Details__c'] = re.sub(r'http[s]?://\S+', '', order_details)
78
+
79
  return render_template("order_history.html", orders=orders)
80
 
81
  except Exception as e:
 
85
 
86
 
87
 
88
+
89
  @app.route("/signup", methods=["GET", "POST"])
90
  def signup():
91
  if request.method == "POST":