From 706bb97460b16e4b3321f9016f90254c3e9078cc Mon Sep 17 00:00:00 2001 From: 3err0 Date: Sat, 1 Mar 2025 09:54:12 +0800 Subject: [PATCH] fixes --- models.py | 4 +++- templates/dashboard.html | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/models.py b/models.py index 21ced21..c59f4db 100644 --- a/models.py +++ b/models.py @@ -60,4 +60,6 @@ class Booking(db.Model): listing_id = db.Column(db.Integer, db.ForeignKey('listing.id'), nullable=False) check_in = db.Column(db.DateTime, nullable=False) check_out = db.Column(db.DateTime, nullable=False) - guests = db.Column(db.Integer, nullable=False) \ No newline at end of file + guests = db.Column(db.Integer, nullable=False) + + listing = db.relationship('Listing', backref='bookings') \ No newline at end of file diff --git a/templates/dashboard.html b/templates/dashboard.html index 7068f18..ae14028 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -73,7 +73,7 @@ {{ booking.user_id }} {{ booking.listing.title if booking.listing else 'Unknown' }} {{ booking.listing.location if booking.listing else 'Unknown' }} - {{ booking.listing.property_type if booking.listing else 'Unknown' }} + {{ booking.listing.PROPERTY_TYPES.get(booking.listing.property_type, 'Unknown') }} {{ booking.check_in.strftime('%Y-%m-%d') }} {{ booking.check_out.strftime('%Y-%m-%d') }}