This commit is contained in:
2025-01-28 13:44:58 +08:00
parent 8aa9341be5
commit 6e14b6d9e0
+7 -2
View File
@@ -11,10 +11,15 @@ def load_user(user_id):
@app.route('/')
def home():
page = request.args.get('page', 1, type=int)
per_page = 10
property_type = request.args.get('property_type')
listings = Listing.query.all()
query = Listing.query
if property_type:
listings = [l for l in listings if l.property_type == property_type]
query = query.filter_by(property_type=property_type)
listings = query.paginate(page=page, per_page=per_page)
return render_template('index.html', listings=listings)
@app.route('/login', methods=['GET', 'POST'])