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') }}