show upload document
This commit is contained in:
@@ -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.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user