changeset 4:2fd80a9ec3a2

Add action and method parameters to form objects.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 15 Jun 2011 11:06:38 +0200
parents 92d05dfff3aa
children 0f59922d36d2
files src/ltpdarepo/form.py src/ltpdarepo/templates/forms.html
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/form.py	Wed Jun 15 11:05:07 2011 +0200
+++ b/src/ltpdarepo/form.py	Wed Jun 15 11:06:38 2011 +0200
@@ -20,6 +20,9 @@
     # token field
     csrf = wtforms.fields.HiddenField()
 
+    method = 'POST'
+    action = ''
+
     def __init__(self, formdata=None, *args, **kwargs):
         # set token
         token = session.get(CSRF_SESSION_KEY, None)
--- a/src/ltpdarepo/templates/forms.html	Wed Jun 15 11:05:07 2011 +0200
+++ b/src/ltpdarepo/templates/forms.html	Wed Jun 15 11:06:38 2011 +0200
@@ -1,5 +1,5 @@
 {% macro render(form) -%}
-  <form action="" method="post" enctype="multipart/form-data" >
+  <form action="{{ form.action }}" method="{{ form.method }}" enctype="multipart/form-data" >
     <fieldset>
       {% for field in form %}
         {{ render_form_field(field) }}