Monday, October 18, 2010

Re: MaxValueValidator to validate a model

On 10/15/2010 9:18 PM, refreegrata wrote:
> Now works.
> validators=[MaxValueValidator(Decimal('14.5'))
>
> But I must to do an explicit declaration Decimal('14.5').
>
> Somebody knows why?

Because only decimal numbers can give exact comparisons to arbitrary
decimal values. You would not want your input to validate correctly with
an entry of (say) 14.500000000000001, which might be possible if the
limit was expressed as a floating-point number.

regards
Steve
--
DjangoCon US 2010 September 7-9 http://djangocon.us/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate