Skip to content
Permalink
Browse files

add poll data and display it

  • Loading branch information
szabgab committed Feb 17, 2015
1 parent c781242 commit 2a293a4051bc4ba3ae4c8b95dd1e02b669a76b82
Showing with 14 additions and 3 deletions.
  1. +6 −1 poll.py
  2. +8 −2 templates/poll.html
@@ -2,9 +2,14 @@
import os
app = Flask(__name__)

poll_data = {
'question' : 'Which web framework do you use?',
'fields' : ['Flask', 'Django', 'TurboGears', 'web2py', 'pylonsproject']
}

@app.route('/')
def root():
return render_template('poll.html')
return render_template('poll.html', data=poll_data)

if __name__ == "__main__":
app.run(debug=True)
@@ -1,9 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Poll</title>
<title>{{ data.question }}</title>
</head>
<body>
<h1>Poll</h1>
<h1>{{ data.question }}</h1>
<form action="/poll">
{% for e in data.fields %}
<input type="radio" name="field" value="{{ e }}"> {{ e }}<br>
{% endfor %}
<input type="submit" value="Vote" />
</form>
</body>
</html>

0 comments on commit 2a293a4

Please sign in to comment.
You can’t perform that action at this time.