more fields

This commit is contained in:
warren yun 2024-10-22 17:51:44 -04:00
parent 7defb52a56
commit 0268f70f9b
4 changed files with 29 additions and 6 deletions

View file

@ -31,8 +31,9 @@ def register():
phone = request.form.get('phone_number')
gender = request.form.get('gender')
country = request.form.get('country')
print(school)
age = request.form.get('age')
dietary_restrictions = request.form.get('dietary_restrictions')
newsletter = request.form.get('newsletter')
# if password == password_c:
# # Passwords match!

View file

@ -1,3 +1,4 @@
United States of America,US,USA,840,ISO 3166-2:US,Americas,Northern America,"",019,021,""
Afghanistan,AF,AFG,004,ISO 3166-2:AF,Asia,Southern Asia,"",142,034,""
Åland Islands,AX,ALA,248,ISO 3166-2:AX,Europe,Northern Europe,"",150,154,""
Albania,AL,ALB,008,ISO 3166-2:AL,Europe,Southern Europe,"",150,039,""
@ -233,7 +234,6 @@ Uganda,UG,UGA,800,ISO 3166-2:UG,Africa,Sub-Saharan Africa,Eastern Africa,002,202
Ukraine,UA,UKR,804,ISO 3166-2:UA,Europe,Eastern Europe,"",150,151,""
United Arab Emirates,AE,ARE,784,ISO 3166-2:AE,Asia,Western Asia,"",142,145,""
United Kingdom of Great Britain and Northern Ireland,GB,GBR,826,ISO 3166-2:GB,Europe,Northern Europe,"",150,154,""
United States of America,US,USA,840,ISO 3166-2:US,Americas,Northern America,"",019,021,""
United States Minor Outlying Islands,UM,UMI,581,ISO 3166-2:UM,Oceania,Micronesia,"",009,057,""
Uruguay,UY,URY,858,ISO 3166-2:UY,Americas,Latin America and the Caribbean,South America,019,419,005
Uzbekistan,UZ,UZB,860,ISO 3166-2:UZ,Asia,Central Asia,"",142,143,""

1 Afghanistan United States of America AF US AFG USA 004 840 ISO 3166-2:AF ISO 3166-2:US Asia Americas Southern Asia Northern America 142 019 034 021
1 United States of America US USA 840 ISO 3166-2:US Americas Northern America 019 021
2 Afghanistan Afghanistan AF AF AFG AFG 004 004 ISO 3166-2:AF ISO 3166-2:AF Asia Asia Southern Asia Southern Asia 142 142 034 034
3 Åland Islands Åland Islands AX AX ALA ALA 248 248 ISO 3166-2:AX ISO 3166-2:AX Europe Europe Northern Europe Northern Europe 150 150 154 154
4 Albania Albania AL AL ALB ALB 008 008 ISO 3166-2:AL ISO 3166-2:AL Europe Europe Southern Europe Southern Europe 150 150 039 039
234 Ukraine Ukraine UA UA UKR UKR 804 804 ISO 3166-2:UA ISO 3166-2:UA Europe Europe Eastern Europe Eastern Europe 150 150 151 151
235 United Arab Emirates United Arab Emirates AE AE ARE ARE 784 784 ISO 3166-2:AE ISO 3166-2:AE Asia Asia Western Asia Western Asia 142 142 145 145
236 United Kingdom of Great Britain and Northern Ireland United Kingdom of Great Britain and Northern Ireland GB GB GBR GBR 826 826 ISO 3166-2:GB ISO 3166-2:GB Europe Europe Northern Europe Northern Europe 150 150 154 154
United States of America US USA 840 ISO 3166-2:US Americas Northern America 019 021
237 United States Minor Outlying Islands United States Minor Outlying Islands UM UM UMI UMI 581 581 ISO 3166-2:UM ISO 3166-2:UM Oceania Oceania Micronesia Micronesia 009 009 057 057
238 Uruguay Uruguay UY UY URY URY 858 858 ISO 3166-2:UY ISO 3166-2:UY Americas Americas Latin America and the Caribbean Latin America and the Caribbean South America 019 019 419 419 005
239 Uzbekistan Uzbekistan UZ UZ UZB UZB 860 860 ISO 3166-2:UZ ISO 3166-2:UZ Asia Asia Central Asia Central Asia 142 142 143 143

View file

@ -1,5 +1,5 @@
from flask_wtf import FlaskForm
from wtforms import BooleanField, PasswordField, SelectField, StringField, SubmitField, widgets
from wtforms import BooleanField, IntegerField, PasswordField, SelectField, StringField, SubmitField, widgets
from wtforms.validators import DataRequired
import os
@ -17,11 +17,15 @@ class RegisterForm(FlaskForm):
validators=[DataRequired()])
school = SelectField("School", choices=[(school, school) for school in schools_list], widget=widgets.Select())
phone_number = StringField("Phone number", validators=[DataRequired()])
age = IntegerField("Age", validators=[DataRequired()])
dietary_restrictions = StringField("Dietary Restrictions (Optional)")
gender = SelectField("Gender", choices=[("F", "Female"), ("M", "Male"),
("NB", "Non-binary/Other")],
widget=widgets.Select())
country = SelectField("Country", choices=[(country.split(",")[0], country.split(",")[0]) for country in countries_list], widget=widgets.Select())
newsletter = BooleanField("Subscribe to the MLH newsletter?")
agree_coc = BooleanField("I confirm that I have read and agree to the Code of Conduct", validators=[DataRequired()])
submit = SubmitField("Register")
class LoginForm(FlaskForm):

View file

@ -60,18 +60,36 @@
</div>
</div>
<div class="row">
<div class="col">
<div class="form-floating mb-3 required">
{{ form.phone_number(class="form-control") }}
{{ form.phone_number.label() }}
</div>
</div>
<div class="col">
<div class="form-floating mb-3 required">
{{ form.age(class="form-control") }}
{{ form.age.label() }}
</div>
</div>
</div>
<div class="form-floating mb-3 required">
{{ form.gender(class="form-control") }}
{{ form.gender.label() }}
</div>
<div class="form-floating mb-3">
{{ form.dietary_restrictions(class="form-control") }}
{{ form.dietary_restrictions.label() }}
</div>
<div class="form-check mb-3 required">
{{ form.agree_coc }}
I confirm that I have read and agree to the <a href="https://static.mlh.io/docs/mlh-code-of-conduct.pdf" target="_blank">MLH Code of Conduct</a>
</div>
<div class="form-check mb-3">
{{ form.newsletter }}
Subscribe to the MLH newsletter?
</div>
{{ render_field(form.submit) }}
</form>
</div>