philomat/django-form-designer — Issue #35: Decimal validation fails
Author: sbnoemi
Created: 2012-01-20 17:09:08+00:00
State: open

Thanks for this awesome app -- you just saved us about a month worth of development time.

Ran into a bug with decimal validation, probably due to the fact that Decimal / Float comparison is unreliable, so a Decimal field with min val 1.5 and max val 100 will throw a validation error if you submit 30 via the form.

>>> from decimal import Decimal
>>> d = Decimal('30')
>>> d > 1.5
True
>>> d < 100.0
False
>>> s = str(100.0)
>>> d < Decimal(s)
True