forked from SI507-206-W18/lec24
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
51 lines (43 loc) · 1.42 KB
/
app.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
41
42
43
44
45
46
47
48
49
50
51
from flask import Flask, render_template, request
import model
app = Flask(__name__)
@app.route('/')
def index():
return '''
<img src="/static/blockM.png"/>
<h1>Michigan Sports Info!</h1>
<ul>
<li><a href="/bball"> Men's Basketball </a></li>
</ul>
'''
@app.route('/bball', methods=['GET', 'POST'])
def bball():
if request.method == 'POST':
sortby = request.form['sortby']
sortorder = request.form['sortorder']
seasons = model.get_bball_seasons(sortby, sortorder)
else:
seasons = model.get_bball_seasons()
return render_template("seasons.html", seasons=seasons)
@app.route('/football', methods=['GET', 'POST'])
def football():
if request.method == 'POST':
sortby = request.form['sortby']
sortorder = request.form['sortorder']
seasons = model.get_fball_seasons(sortby, sortorder)
else:
seasons = model.get_fball_seasons()
return render_template("fseasons.html", seasons=seasons)
@app.route('/hello', methods=['GET', 'POST'])
def hello():
if request.method == 'POST':
firstname = request.form['firstname']
lastname = request.form['lastname']
else:
firstname = ''
lastname = ''
return render_template("hello.html", firstname=firstname, lastname=lastname)
if __name__ == '__main__':
model.init_bball()
model.init_fball()
app.run(debug=True)