Q:

Number Validation Between Range 0 and 100

My current WTForms Number validator code is as follows:
class ScoreForm(Form):
    score = FloatField(validators=[DataRequired(), NumberRange(0,100)])
    submit = SubmitField()

I want the score to be specified between 0 and 100 (inclusive of both and decimals allowed).
There are two problems with the above code:

It does not let me enter 0 as the value. Doing so spits out the built-in error message
[This field is required.]

If I enter some string into the field, i get the same error message as above, which is not the correct message.

How do I correct these two problems?

A:

After lot of weird behavior with FloatField and DecimalField, I finally used StringField and wrote a custom validator for my above use case as follows:
class ScoreForm(Form):
    score = StringField(validators=[DataRequired()])
    add_score = SubmitField()

    def __init__(self):
        Form.__init__(self)

    def validate(self):
        if not Form.validate(self):
            return False
        try:
            float(self.score.data)
        except ValueError:
            self.score.errors.append(
                'Score must be a valid number')
            return False
        if 0 > float(self.score.data) > 100:
            self.score.errors.append(
                'Score must be in the range 0-100')
            return False
        return True

