-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.py
40 lines (37 loc) · 1.41 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, SelectField, DateField
from wtforms.validators import DataRequired
from datetime import datetime
from utils import datetime_to_dateformat
# create a Form class
class ContractForm(FlaskForm): # validar para el futuro
sexo = SelectField(
"Sexo", choices=[("Don", "Don"), ("Doña", "Doña")], validators=[DataRequired()]
)
dni = StringField(
"DNI", validators=[DataRequired()]
) # tipo numero y te calcula la letra
nombre = StringField("Nombre", validators=[DataRequired()])
apellidos = StringField("Apellidos", validators=[DataRequired()])
localidad_nacimiento = StringField("Localidad", validators=[DataRequired()])
provincia_nacimiento = StringField("Provincia", validators=[DataRequired()])
letra = SelectField(
"Letra",
choices=[("A", "A"), ("B", "B"), ("C", "C")],
validators=[DataRequired()],
)
precio = SelectField(
"Precio",
choices=[("350", "350"), ("450", "450"), ("500", "500")],
validators=[DataRequired()],
) # tipo float
dormitorios = SelectField(
"Dormitorios", choices=[("1", "1"), ("2", "2")], validators=[DataRequired()]
)
fecha_hoy = DateField(
"Fecha hoy",
format="%Y-%m-%d",
validators=[DataRequired()],
default=datetime.now().date(),
)
submit = SubmitField("Submit")