              raise validators.CriticalValidationError, gettext("Enter a whole number between 0 and 32,767.")
  
  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. 
 
</s> remove         validator_list = [self.isValidFloat] + validator_list
        TextField.__init__(self, field_name, max_digits+2, max_digits+2, is_required, validator_list)
 </s> add         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)  </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     order) and validates whether the field is a float with less than the
    maximum number of digits and decimal place.
 </s> add     order) and validates whether the field is a decimal with no more than the
    maximum number of digits and decimal places. </s> remove ``IsValidFloat``
 </s> add ``IsValidDecimal`` </s> remove A floating-point number. Has two **required** arguments:

    ======================  ===================================================
    Argument                Description
    ======================  ===================================================
    ``max_digits``          The maximum number of digits allowed in the number.

    ``decimal_places``      The number of decimal places to store with the
                            number.
    ======================  ===================================================

For example, to store numbers up to 999 with a resolution of 2 decimal places,
you'd use::

    models.FloatField(..., max_digits=5, decimal_places=2)

And to store numbers up to approximately one billion with a resolution of 10
decimal places::

    models.FloatField(..., max_digits=19, decimal_places=10)
 </s> add A floating-point number represented in Python by a ``float`` instance.
    def __init__(self, field_name, is_required=False, validator_list=None): 
        if validator_list is None: validator_list = [] 
        validator_list = [validators.isValidFloat] + validator_list 
        TextField.__init__(self, field_name, is_required=is_required, validator_list=validator_list) 
 
    def html2python(data): 
        if data == '' or data is None: 
            return None 
        return float(data) 
    html2python = staticmethod(html2python) 
 
class DecimalField(TextField): 
              raise validators.CriticalValidationError, gettext("Enter a whole number between 0 and 32,767.")
  
  class FloatField(TextField):
    def __init__(self, field_name, is_required=False, validator_list=None): 
        if validator_list is None: validator_list = [] 
        validator_list = [validators.isValidFloat] + validator_list 
        TextField.__init__(self, field_name, is_required=is_required, validator_list=validator_list) 
 
    def html2python(data): 
        if data == '' or data is None: 
            return None 
        return float(data) 
    html2python = staticmethod(html2python) 
 
class DecimalField(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. 
keep keep add 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