diff --git a/models.py b/models.py index f46e54b..100d094 100644 --- a/models.py +++ b/models.py @@ -19,6 +19,7 @@ class Listing(db.Model): images = db.relationship('Image', backref='listing', lazy=True) latitude = db.Column(db.Float, nullable=True) longitude = db.Column(db.Float, nullable=True) + guests = db.Column(db.Integer, nullable=False, default=1) PROPERTY_TYPES = { 'house': 'Дом', diff --git a/routes.py b/routes.py index 61bec50..0f344e6 100644 --- a/routes.py +++ b/routes.py @@ -71,7 +71,8 @@ def create_listing(): property_type = request.form['property_type'] latitude = request.form.get('latitude') longitude = request.form.get('longitude') - listing = Listing(title=title, description=description, price=price, location=location, property_type=property_type, host_id=current_user.id, latitude=latitude, longitude=longitude) + guests = request.form['guests'] + listing = Listing(title=title, description=description, price=price, location=location, property_type=property_type, host_id=current_user.id, latitude=latitude, longitude=longitude, guests=guests) db.session.add(listing) db.session.flush() diff --git a/templates/booking.html b/templates/booking.html index 78271dd..3ccadb4 100644 --- a/templates/booking.html +++ b/templates/booking.html @@ -16,7 +16,7 @@
- +
diff --git a/templates/create_listing.html b/templates/create_listing.html index d28915d..243424f 100644 --- a/templates/create_listing.html +++ b/templates/create_listing.html @@ -39,6 +39,10 @@ +
+ + +