summaryrefslogtreecommitdiff
path: root/ishtar/furnitures/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2011-06-13 23:45:45 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2011-06-13 23:45:45 +0200
commit08d79a231d023b9e37159469ae74b540709092d6 (patch)
treebc3490b2d91b2b04d3590cb05e1b6606519c5e67 /ishtar/furnitures/forms.py
parent25107933ce4935bf2c3b3bbbcd207706708d5264 (diff)
downloadIshtar-08d79a231d023b9e37159469ae74b540709092d6.tar.bz2
Ishtar-08d79a231d023b9e37159469ae74b540709092d6.zip
Volume and weight uses float (closes #446)
Diffstat (limited to 'ishtar/furnitures/forms.py')
-rw-r--r--ishtar/furnitures/forms.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py
index 77e2c9b7e..3d663d089 100644
--- a/ishtar/furnitures/forms.py
+++ b/ishtar/furnitures/forms.py
@@ -70,6 +70,15 @@ regexp_name = re.compile(r'^[\w\- ]+$', re.UNICODE)
name_validator = validators.RegexValidator(regexp_name,
_(u"Enter a valid name consisting of letters, spaces and hyphens."), 'invalid')
+class FloatField(forms.FloatField):
+ """
+ Allow the use of comma for separating float fields
+ """
+ def clean(self, value):
+ if value:
+ value = value.replace(',', '.').replace('%', '')
+ return super(FloatField, self).clean(value)
+
class FinalForm(forms.Form):
final = True
form_label = _("Confirm")