  class FloatField(TextField):
      def __init__(self, field_name, max_digits, decimal_places, is_required=False, validator_list=None):
          if validator_list is None: validator_list = []
          self.max_digits, self.decimal_places = max_digits, decimal_places
          validator_list = [self.isValidFloat] + validator_list
          TextField.__init__(self, field_name, max_digits+2, max_digits+2, is_required, validator_list)
  
      def isValidFloat(self, field_data, all_data):
          v = validators.IsValidFloat(self.max_digits, self.decimal_places)
          try:
              v(field_data, all_data)
 
</s> remove     def isValidFloat(self, field_data, all_data):
        v = validators.IsValidFloat(self.max_digits, self.decimal_places)
 </s> add     def isValidDecimal(self, field_data, all_data): 
        v = validators.IsValidDecimal(self.max_digits, self.decimal_places)  </s> remove     def __init__(self, verbose_name=None, name=None, max_digits=None, decimal_places=None, **kwargs):
        self.max_digits, self.decimal_places = max_digits, decimal_places
        Field.__init__(self, verbose_name, name, **kwargs)
 </s> add  </s> remove         return [curry(oldforms.FloatField, max_digits=self.max_digits, decimal_places=self.decimal_places)]
 </s> add         return [oldforms.FloatField]

    def formfield(self, **kwargs):
        defaults = {'form_class': forms.FloatField}
        defaults.update(kwargs)
        return super(FloatField, self).formfield(**defaults)
        validator_list = [self.isValidDecimal] + validator_list 
        # Initialise the TextField, making sure it's large enough to fit the number with a - sign and a decimal point. 
        super(DecimalField, self).__init__(field_name, max_digits+2, max_digits+2, is_required, validator_list) 
  class FloatField(TextField):
      def __init__(self, field_name, max_digits, decimal_places, is_required=False, validator_list=None):
          if validator_list is None: validator_list = []
          self.max_digits, self.decimal_places = max_digits, decimal_places
        validator_list = [self.isValidDecimal] + validator_list 
        # Initialise the TextField, making sure it's large enough to fit the number with a - sign and a decimal point. 
        super(DecimalField, self).__init__(field_name, max_digits+2, max_digits+2, is_required, validator_list) 
        validator_list = [self.isValidDecimal] + validator_list 
        # Initialise the TextField, making sure it's large enough to fit the number with a - sign and a decimal point. 
        super(DecimalField, self).__init__(field_name, max_digits+2, max_digits+2, is_required, validator_list) 
  
      def isValidFloat(self, field_data, all_data):
          v = validators.IsValidFloat(self.max_digits, self.decimal_places)
          try:
              v(field_data, all_data)
keep keep keep keep replace replace keep keep keep keep keep
 Fixed #2365, #3324 -- Renamed FloatField to DecimalField and changed the code
to return Decimal instances in Python for this field. Backwards incompatible
change.

Added a real FloatField (stores floats in the database) and support for
FloatField and DecimalField in newforms (analogous to IntegerField).

Included decimal.py module (as django.utils._decimal) from Python 2.4. This is
license compatible with Django and included for Python 2.3 compatibility only.

Large portions of this work are based on patches from Andy Durdin and Jorge
Gajon.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@5302 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/oldforms/__init__.py