Your issue is that because you override process_formdata
, you are replacing the default processing code (which attempts to convert the string into a decimal, and thus raises an error if it cannot) with your own code. You'll want to make sure that your implementation of process_formdata
manually calls the parent's process_formdata
method so that its logic is also run, like so...
class DollarField(DecimalField):
def process_formdata(self, valuelist):
if len(valuelist) == 1:
self.data = [valuelist[0].strip('$').replace(',', '')]
else:
self.data = []
# Calls "process_formdata" on the parent types of "DollarField",
# which includes "DecimalField"
super(DollarField).process_formdata(self.data)