Permalink
Browse files

Merge pull request #39 from sbnoemi/decimal_validation

Validate Decimal fields properly in Python < 2.7
  • Loading branch information...
2 parents 30f2fd3 + 048a4e3 commit c72149cf3bcc7c0696d7581f927c6e38872463b2 @samluescher committed Jan 28, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 form_designer/models.py
View
@@ -1,5 +1,6 @@
import re
import hashlib, uuid
+from decimal import Decimal
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
@@ -240,8 +241,8 @@ def get_form_field_init_args(self):
if self.field_class == 'django.forms.DecimalField':
args.update({
- 'max_value': self.max_value,
- 'min_value': self.min_value,
+ 'max_value': Decimal(str(self.max_value)),
+ 'min_value': Decimal(str(self.min_value)),
'max_digits': self.max_digits,
'decimal_places': self.decimal_places,
})

0 comments on commit c72149c

Please sign in to comment.