From 424bb885caa8b9565c150fe58360e6784ccf542c Mon Sep 17 00:00:00 2001 From: 3err0 Date: Mon, 20 Jan 2025 17:51:42 +0800 Subject: [PATCH] view listing --- routes.py | 5 +++++ templates/view.html | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 templates/view.html diff --git a/routes.py b/routes.py index a77fd8a..f6dc08a 100644 --- a/routes.py +++ b/routes.py @@ -115,3 +115,8 @@ def booking(listing_id): db.session.commit() return redirect(url_for('home')) return render_template('booking.html', listing=listing, unavailable_dates=unavailable_dates) + +@app.route('/view/', methods=['GET']) +def view_listing(listing_id): + listing = Listing.query.get_or_404(listing_id) + return render_template('view.html', listing=listing) \ No newline at end of file diff --git a/templates/view.html b/templates/view.html new file mode 100644 index 0000000..3cfb980 --- /dev/null +++ b/templates/view.html @@ -0,0 +1,21 @@ +{% extends 'base.html' %} +{% block title %}View Listing{% endblock %} + +{% block content %} +
+

{{ listing.title }}

+ {% if listing.images|length > 0 %} + + {% endif %} +

Description: {{ listing.description }}

+

Price: ${{ listing.price }}

+

Location: {{ listing.location }}

+

Property Type: {{ listing.property_type }}

+

Max Guests: {{ listing.guests }}

+

Rooms: {{ listing.rooms }}

+

Bathrooms: {{ listing.bathrooms }}

+

Beds: {{ listing.beds }}

+ + Book This Listing +
+{% endblock %} \ No newline at end of file