from ....fields import DecimalField
from .widgets import BRDecimalInput

from decimal import Decimal


class BRDecimalField(DecimalField):
    widget = BRDecimalInput

    def to_python(self, value):
        value = value.replace(',', '.')
        value = value.replace('.', '', value.count('.')-1)

        return Decimal(value)

@@ -1,12 +1,54 @@
+from django.forms import ValidationError%0A%0A
 from ....fie
@@ -135,16 +135,34 @@
  Decimal
+, DecimalException
 %0A%0A%0Aclass
@@ -352,9 +352,11 @@
 '.')
--
+ - 
 1)%0A%0A
@@ -367,26 +367,143 @@
     
-return Decimal(value
+try:%0A            value = Decimal(value)%0A        except DecimalException:%0A            raise ValidationError(self.error_messages%5B'invalid'%5D
 )%0A

Fix a bug while handling invalid values