  
  from models import *
  
  # A set of functions that can be used to recreate
  # test data objects of various kinds
  def data_create(pk, klass, data):
      instance = klass(id=pk)
      instance.data = data
 
</s> remove         return float(data)
 </s> add         try: 
            import decimal 
        except ImportError:
            from django.utils import decimal
        try: 
            return decimal.Decimal(data) 
        except decimal.InvalidOperation, e: 
            raise ValueError, e  </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. </s> remove invalid_models.fielderrors: "floatfield": FloatFields require a "decimal_places" attribute.
invalid_models.fielderrors: "floatfield": FloatFields require a "max_digits" attribute.
 </s> add invalid_models.fielderrors: "decimalfield": DecimalFields require a "decimal_places" attribute.
invalid_models.fielderrors: "decimalfield": DecimalFields require a "max_digits" attribute.
try:
    import decimal
except ImportError:
    from django.utils import _decimal as decimal
  
  from models import *
try:
    import decimal
except ImportError:
    from django.utils import _decimal as decimal
  
  # A set of functions that can be used to recreate
  # test data objects of various kinds
  def data_create(pk, klass, data):
      instance = klass(id=pk)
      instance.data = data
keep add keep 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 
tests/regressiontests/serializers_regress/tests.py