From bf7c3505a03946e0b818df9c15fae6d34a8207d6 Mon Sep 17 00:00:00 2001 From: 3err0 Date: Sun, 12 Jan 2025 19:54:10 +0800 Subject: [PATCH] show all properties --- routes.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/routes.py b/routes.py index bd7942e..50320f4 100644 --- a/routes.py +++ b/routes.py @@ -12,15 +12,10 @@ def load_user(user_id): @app.route('/') def home(): property_type = request.args.get('property_type') - listings = Listing.query - available_listings = [] - for listing in listings: - bookings = Booking.query.filter_by(listing_id=listing.id).all() - if all(datetime.strptime(booking.check_out, '%Y-%m-%d') < datetime.now() for booking in bookings): - available_listings.append(listing) + listings = Listing.query.all() if property_type: - available_listings = [l for l in available_listings if l.property_type == property_type] - return render_template('index.html', listings=available_listings) + listings = [l for l in listings if l.property_type == property_type] + return render_template('index.html', listings=listings) @app.route('/login', methods=['GET', 'POST']) def login():