|
| 1 | +from flask_wtf import FlaskForm |
| 2 | +from wtforms import StringField, SubmitField, MultipleFileField, SelectField, IntegerField, DateField, TimeField, TextAreaField |
| 3 | +from wtforms.validators import Required |
| 4 | +from ..models import User |
| 5 | +from wtforms import ValidationError |
| 6 | + |
| 7 | + |
| 8 | +class ListingForm(FlaskForm): |
| 9 | + images = MultipleFileField('Upload a few images',validators=[FileAllowed(['jpg', 'png']), Required]) |
| 10 | + location = SelectField('Neighbourhood', choices=[('eastleigh', 'Eastleigh'), ('karen', 'Karen'), |
| 11 | + ('kileleshwa', 'Kileleshwa'), ('Langata', 'Langata'), |
| 12 | + ('lavington', 'Lavington'), ('muthaiga', 'Muthaiga'), |
| 13 | + ('ngara', 'Ngara'), ('runda', 'Runda'), ('donholm', 'Donholm'), |
| 14 | + ('south-B', 'South-B'), ('south-C', 'South-C'), |
| 15 | + ('upperhill', 'Upperhill'), ('westlands', 'Westlands')]) |
| 16 | + category = SelectField('Type', validators=[Required], choices=[('apartment', 'Apartment'), |
| 17 | + ('bungalow', 'Bungalow'), |
| 18 | + ('maisonette', 'Maisonette')]) |
| 19 | + bedrooms = SelectField('Size', validators=[Required], choices=[('bedsitter', 'Bedsitter'), ('1 Bedroom', '1 Bedroom'), |
| 20 | + ('2 Bedroom', '2 Bedroom'), ('3 Bedroom', '3 Bedroom'), |
| 21 | + ('4 Bedroom', '4 Bedroom')]) |
| 22 | + pricing = IntegerField('Price', validators=[Required]) |
| 23 | + description = TextAreaField('Description', validators=[Required]) |
| 24 | + view_date = DateField('Date', validators=[Required]) |
| 25 | + view_start_time = TimeField('From', min="9:00", max="18:00", validators=[Required]) |
| 26 | + view_end_time = TimeField('To', validators=[Required]) |
| 27 | + submit = SubmitField('Submit') |
0 commit comments