title: WTForms How to use a DecimalField which generates proper field errors on bad input
body: <p>Have a look at this example</p>
  
  <pre><code>class MyForm(ForM):
      ...snip...
      quantity = DecimalField(u'Quantity', [NumberRange(1, 8)])
      ...snip...
  </code></pre>
  
  <p>This works nicely if the user is co-operative and enters something that can be coerced to a numeric type.  However, if the user enters, say: "asdf" into this field in the browser then <code>DecimalField</code> throws a <code>Type Error</code> when I try to render it in the browser.</p>
  
  <p>Here's the relevant parts of the traceback:</p>
  
  <pre><code>Traceback (most recent call last):
      File "/path/to/app/venv/local/lib/python2.7/site-packages/jinja2/environment.py", line 894, in render
        return self.environment.handle_exception(exc_info, True)
      File "/path/to/app/www/templates/submodule/user/submission.html", line 26, in block "submodule_content"
        {{form.quantity}}
      File "/path/to/app/venv/local/lib/python2.7/site-packages/wtforms/fields/core.py", line 139, in __call__
        return self.widget(self, **kwargs)
      File "/path/to/app/venv/local/lib/python2.7/site-packages/wtforms/widgets/core.py", line 123, in __call__
        kwargs['value'] = field._value()
      File "/path/to/app/venv/local/lib/python2.7/site-packages/wtforms/fields/core.py", line 542, in _value
        return format % self.data
  TypeError: a float is required
  </code></pre>
  
  <p>Instead of this behaviour, I'd like the field to have an error added to itself, so that I can still render t.</p>
  
  <p>My current solution involves using a <code>TextField</code> instead of a <code>DecimalField</code> and providing an <code>IsNumeric</code> validator with a call method like:</p>
  
  <pre><code>def __call__(self, form, field):
      if field.data:
          try:
              field.data = float(field.data)
          except ValueError as e:
              raise ValidationError(self.message)
  </code></pre>
  
  <p>This works nearly perfectly, and is my current solution, but surely there must be a wtforms-idiomatic way to do this.</p>