Last active
August 29, 2015 14:02
-
-
Save nsfyn55/039288a4c1a6dd6ca8ee to your computer and use it in GitHub Desktop.
Stack Predictions Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
from wtforms import Form, IntegerField, FieldList, FormField, TextField | |
from werkzeug.datastructures import MultiDict | |
Prediction = namedtuple('Prediction', ['id']) | |
predictions = [Prediction(id=1), Prediction(id=2)] | |
class PredictionForm(Form): | |
id = IntegerField() | |
home = TextField() | |
away = TextField() | |
class PredictionListForm(Form): | |
predictions = FieldList(FormField(PredictionForm)) | |
form = PredictionListForm(data=MultiDict({'predictions': predictions})) | |
print form.predictions() |
Python 2.7.6
Flask==0.10.1
Jinja2==2.7.2
MarkupSafe==0.23
WTForms==2.0
WebOb==1.4
Werkzeug==0.9.4
itsdangerous==0.24
wsgiref==0.1.2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the result