property types

This commit is contained in:
2025-01-16 13:23:50 +08:00
parent 7eeab87862
commit 75e9cbda7b
3 changed files with 14 additions and 2 deletions
+8
View File
@@ -20,6 +20,14 @@ class Listing(db.Model):
latitude = db.Column(db.Float, nullable=True)
longitude = db.Column(db.Float, nullable=True)
PROPERTY_TYPES = {
'house': 'Дом',
'villa': 'Вилла',
'flat': 'Квартира',
'room': 'Комната',
'hotel': 'Гостиница'
}
class Image(db.Model):
id = db.Column(db.Integer, primary_key=True)
url = db.Column(db.String(300), nullable=False)
+1 -1
View File
@@ -82,7 +82,7 @@ def create_listing():
db.session.commit()
return redirect(url_for('dashboard'))
return render_template('create_listing.html')
return render_template('create_listing.html', property_types=Listing.PROPERTY_TYPES)
@app.route('/booking/<int:listing_id>', methods=['GET', 'POST'])
@login_required
+5 -1
View File
@@ -23,7 +23,11 @@
</div>
<div class="mb-3">
<label for="property_type" class="form-label">Property Type</label>
<input type="text" class="form-control" id="property_type" name="property_type" required>
<select class="form-select" id="property_type" name="property_type" required>
{% for key, value in property_types.items() %}
<option value="{{ key }}">{{ value }}</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<label for="latitude" class="form-label">Latitude</label>