Commits

Anonymous committed 173e0f0

fix for changed field name

Comments (0)

Files changed (2)

flaskext/wtf/__init__.py

             fields = [f for f in self if isinstance(f, HiddenField)]
 
         rv = [u'<div style="display:none;">']
-        rv += [unicode(field) for field in fields]
+        for field in fields:
+            if isinstance(field, basestring):
+                field = getattr(self, field)
+            rv.append(unicode(field))
         rv.append(u"</div>")
 
         return Markup(u"".join(rv))

tests/__init__.py

         class HiddenFieldsForm(Form):
             name = HiddenField()
             url = HiddenField()
+            method = HiddenField()
             secret = HiddenField()
             submit = SubmitField("Submit")
 
+            def __init__(self, *args, **kwargs):
+                super(HiddenFieldsForm, self).__init__(*args, **kwargs)
+                self.method.name = '_method'
+
         class SimpleForm(Form):
             pass
 
     def test_hidden_tag(self):
 
         response = self.client.get("/hidden/")
-        assert response.data.count('type="hidden"') == 4
+        assert response.data.count('type="hidden"') == 5
+        assert 'name="_method"' in response.data
+
 
 class TestCSRF(TestCase):