user dashboard

This commit is contained in:
2025-03-01 23:12:56 +08:00
parent eb2500a74d
commit a202488ff7
2 changed files with 41 additions and 1 deletions
+5 -1
View File
@@ -122,7 +122,11 @@ def dashboard():
documents = {doc.user_id: doc for doc in Document.query.all()}
bookings = Booking.query.join(Listing).filter(Listing.host_id == current_user.id).all()
return render_template('dashboard.html', listings=listings, users=users, documents=documents, bookings=bookings)
return redirect(url_for('home'))
else:
bookings = Booking.query.filter_by(user_id=current_user.id).join(Listing).add_columns(
Listing.title, Listing.location, Listing.property_type, Booking.check_in, Booking.check_out
).all()
return render_template('user.html', bookings=bookings)
@app.route('/create-listing', methods=['GET', 'POST'])
@login_required