Skip to content

Instantly share code, notes, and snippets.

@shajiquan
Last active November 16, 2015 04:42
Show Gist options
  • Save shajiquan/f937cf831ab8bd7511c1 to your computer and use it in GitHub Desktop.
Save shajiquan/f937cf831ab8bd7511c1 to your computer and use it in GitHub Desktop.
Get list form post in Tornado
class FormHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):
return self.render("forms.html")
def post(self, *args, **kwargs):
orders = self.get_body_arguments("order", None)
print("orders", orders)
print("type(orders)", type(orders))
if isinstance(orders, list):
orders.append("999999")
self.write(str(orders))
<form action="">
<input type="input" name="order" value=2 />
<input type="input" name="order" value=4 />
<input type="input" name="order" value=1 />
<input type="input" name="order" value=3 />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment