diff options
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 |
commit | 7422ebfa33a90927b8658515293fb09b6dbff424 (patch) | |
tree | bc3490b2d91b2b04d3590cb05e1b6606519c5e67 /ishtar/furnitures/forms.py | |
parent | 147f67480e1156444656daad9223cde9486da0b4 (diff) | |
download | Ishtar-7422ebfa33a90927b8658515293fb09b6dbff424.tar.bz2 Ishtar-7422ebfa33a90927b8658515293fb09b6dbff424.zip |
Volume and weight uses float (closes #446)
Diffstat (limited to 'ishtar/furnitures/forms.py')
-rw-r--r-- | ishtar/furnitures/forms.py | 9 |
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") |