Difference between revisions of "Register and Edit profile in a Flask App"
(Created page with "=Create sign up form= =Create sign up template= =Create sign up route= =Insert data into users table=") |
(→Create sign up form) |
||
Line 1: | Line 1: | ||
=Create sign up form= | =Create sign up form= | ||
+ | In your 'forms.py' file we need to create a form for the sign-up process. You should have created 'forms.py' when you created your login form. So add the following: | ||
+ | |||
+ | <syntaxhighlight lang=python> | ||
+ | class SignUpForm(FlaskForm): | ||
+ | username = StringField('Username', validators=[DataRequired()]) | ||
+ | password = PasswordField('Password', validators=[DataRequired()]) | ||
+ | confirm = PasswordField('Confirm Password', validators=[DataRequired()]) | ||
+ | email = StringField('Email', validators=[]) | ||
+ | DOB = DateField('DOB', format='%Y-%m-%d') | ||
+ | MF = SelectField(u'Gender', choices=['M', 'F']) | ||
+ | submit = SubmitField('Sign In') | ||
+ | </syntaxhighlight> | ||
=Create sign up template= | =Create sign up template= |
Revision as of 13:07, 23 October 2019
Contents
Create sign up form
In your 'forms.py' file we need to create a form for the sign-up process. You should have created 'forms.py' when you created your login form. So add the following:
class SignUpForm(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
confirm = PasswordField('Confirm Password', validators=[DataRequired()])
email = StringField('Email', validators=[])
DOB = DateField('DOB', format='%Y-%m-%d')
MF = SelectField(u'Gender', choices=['M', 'F'])
submit = SubmitField('Sign In')