summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Hurley <gabehr@gmail.com>2010-12-29 00:04:06 +0000
committerGabriel Hurley <gabehr@gmail.com>2010-12-29 00:04:06 +0000
commit8db865c8fbf7242cbdfe5629fda66564762900ee (patch)
tree87a82a14e5ee4f1fa8c436547a0828022bd99d9c
parenta3169e3e8e58715b222172f48d2d4211a71df578 (diff)
[1.2.X] Fixed #14403 -- Provided some extra resources on the difference between FloatField and DecimalField in the model field reference. Thanks to typeshige for the report and trebor74hr and dmedvinsky for the draft patch.
Backport of [15090] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--docs/ref/models/fields.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 69394480d7..879b4c354b 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -455,6 +455,12 @@ decimal places::
The admin represents this as an ``<input type="text">`` (a single-line input).
+.. note::
+
+ For more information about the differences between the
+ :class:`FloatField` and :class:`DecimalField` classes, please
+ see :ref:`FloatField vs. DecimalField <floatfield_vs_decimalfield>`.
+
``EmailField``
--------------
@@ -661,6 +667,20 @@ A floating-point number represented in Python by a ``float`` instance.
The admin represents this as an ``<input type="text">`` (a single-line input).
+.. _floatfield_vs_decimalfield:
+
+.. admonition:: ``FloatField`` vs. ``DecimalField``
+
+ The :class:`FloatField` class is sometimes mixed up with the
+ :class:`DecimalField` class. Although they both represent real numbers, they
+ represent those numbers differently. ``FloatField`` uses Python's ``float``
+ type internally, while ``DecimalField`` uses Python's ``Decimal`` type. For
+ information on the difference between the two, see Python's documentation on
+ `Decimal fixed point and floating point arithmetic`_.
+
+.. _Decimal fixed point and floating point arithmetic: http://docs.python.org/library/decimal.html
+
+
``ImageField``
--------------