8000 updated boilerplate · realpython/flask-boilerplate@bd889ed · GitHub
[go: up one dir, main page]

Skip to content

Commit bd889ed

Browse files
committed
updated boilerplate
1 parent 0b0a3b8 commit bd889ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1754
-35
lines changed

_updated/app/controllers/pages.py

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,37 @@
1-
from flask import render_template, Blueprint
2-
1+
from flask import render_template, Blueprint, request
2+
from app.forms import *
33

44
blueprint = Blueprint('pages', __name__)
55

66

7+
################
8+
#### routes ####
9+
################
10+
11+
712
@blueprint.route('/')
8-
def index():
9-
return render_template("pages/index.html")
13+
def home():
14+
return render_template('pages/placeholder.home.html')
15+
16+
17+
@blueprint.route('/about')
18+
def about():
19+
return render_template('pages/placeholder.about.html')
20+
21+
22+
@blueprint.route('/login')
23+
def login():
24+
form = LoginForm(request.form)
25+
return render_template('forms/login.html', form=form)
26+
27+
28+
@blueprint.route('/register')
29+
def register():
30+
form = RegisterForm(request.form)
31+
return render_template('forms/register.html', form=form)
32+
33+
34+
@blueprint.route('/forgot')
35+
def forgot():
36+
form = ForgotForm(request.form)
37+
return render_template('forms/forgot.html', form=form)

_updated/app/forms.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from flask_wtf import Form
2+
from wtforms import TextField, PasswordField
3+
from wtforms.validators import DataRequired, EqualTo, Length
4+
5+
6+
class RegisterForm(Form):
7+
name = TextField(
8+
'Username', validators=[DataRequired(), Length(min=6, max=25)]
9+
)
10+
email = TextField(
11+
'Email', validators=[DataRequired(), Length(min=6, max=40)]
12+
)
13+
password = PasswordField(
14+
'Password', validators=[DataRequired(), Length(min=6, max=40)]
15+
)
16+
confirm = PasswordField(
17+
'Repeat Password',
18+
[DataRequired(),
19+
EqualTo('password', message='Passwords must match')]
20+
)
21+
22+
23+
class LoginForm(Form):
24+
name = TextField('Username', [DataRequired()])
25+
password = PasswordField('Password', [DataRequired()])
26+
27+
28+
class ForgotForm(Form):
29+
email = TextField(
30+
'Email', validators=[DataRequired(), Length(min=6, max=40)]
31+
)

_updated/app/static/css/bootstrap-3.0.0.min.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0