From 4f3ad4d912d8cb03d3b362412e84923d741e86c1 Mon Sep 17 00:00:00 2001 From: 3err0 Date: Thu, 30 Jan 2025 10:28:46 +0800 Subject: [PATCH] show upload document --- routes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/routes.py b/routes.py index 1fb6e12..c8d2c86 100644 --- a/routes.py +++ b/routes.py @@ -199,6 +199,10 @@ def booking(listing_id): booked_dates = Booking.query.filter_by(listing_id=listing_id).all() unavailable_dates = [(booking.check_in.strftime('%Y-%m-%d'), booking.check_out.strftime('%Y-%m-%d')) for booking in booked_dates] + user_document = Document.query.filter_by(user_id=current_user.id).first() + if not user_document or not user_document.verified: + return redirect(url_for('upload_document')) + if request.method == 'POST': check_in = datetime.strptime(request.form['check_in'], '%Y-%m-%d') check_out = datetime.strptime(request.form['check_out'], '%Y-%m-%d') @@ -208,9 +212,6 @@ def booking(listing_id): (check_out.strftime('%Y-%m-%d') >= start_date and check_out.strftime('%Y-%m-%d') <= end_date): return render_template('booking.html', listing=listing, unavailable_dates=unavailable_dates, error="Selected dates are not available.") try: - check_in = datetime.strptime(request.form['check_in'], '%Y-%m-%d') - check_out = datetime.strptime(request.form['check_out'], '%Y-%m-%d') - if check_out <= check_in: return render_template('booking.html', listing=listing, unavailable_dates=unavailable_dates, error="Check-out date must be after check-in date.")