summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/forms.txt7
-rw-r--r--docs/model-api.txt55
-rw-r--r--docs/newforms.txt8
-rw-r--r--docs/tutorial02.txt2
4 files changed, 48 insertions, 24 deletions
diff --git a/docs/forms.txt b/docs/forms.txt
index 329e84a1b1..f6cb55a3f6 100644
--- a/docs/forms.txt
+++ b/docs/forms.txt
@@ -567,6 +567,7 @@ check for the given property:
* isValidANSIDate
* isValidANSITime
* isValidEmail
+ * isValidFloat
* isValidImage
* isValidImageURL
* isValidPhone
@@ -664,10 +665,10 @@ fails. If no message is passed in, a default message is used.
Takes an integer argument and when called as a validator, checks that the
field being validated is a power of the integer.
-``IsValidFloat``
+``IsValidDecimal``
Takes a maximum number of digits and number of decimal places (in that
- order) and validates whether the field is a float with less than the
- maximum number of digits and decimal place.
+ order) and validates whether the field is a decimal with no more than the
+ maximum number of digits and decimal places.
``MatchesRegularExpression``
Takes a regular expression (a string) as a parameter and validates the
diff --git a/docs/model-api.txt b/docs/model-api.txt
index 1125d2810f..ae1c37fc8f 100644
--- a/docs/model-api.txt
+++ b/docs/model-api.txt
@@ -184,6 +184,35 @@ A date and time field. Takes the same extra options as ``DateField``.
The admin represents this as two ``<input type="text">`` fields, with
JavaScript shortcuts.
+``DecimalField``
+~~~~~~~~~~~~~~~~
+
+**New in Django development version**
+
+A fixed-precision decimal number, represented in Python by a ``Decimal`` instance.
+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.DecimalField(..., max_digits=5, decimal_places=2)
+
+And to store numbers up to approximately one billion with a resolution of 10
+decimal places::
+
+ models.DecimalField(..., max_digits=19, decimal_places=10)
+
+The admin represents this as an ``<input type="text">`` (a single-line input).
+
``EmailField``
~~~~~~~~~~~~~~
@@ -290,28 +319,16 @@ because the ``match`` applies to the base filename (``foo.gif`` and
``FloatField``
~~~~~~~~~~~~~~
-A floating-point number. Has two **required** arguments:
+**Changed in Django development version**
- ====================== ===================================================
- Argument Description
- ====================== ===================================================
- ``max_digits`` The maximum number of digits allowed in the number.
+A floating-point number represented in Python by a ``float`` instance.
- ``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::
+The admin represents this as an ``<input type="text">`` (a single-line input).
- models.FloatField(..., max_digits=19, decimal_places=10)
+**NOTE:** The semantics of ``FloatField`` have changed in the Django
+development version. See the `Django 0.96 documentation`_ for the old behavior.
-The admin represents this as an ``<input type="text">`` (a single-line input).
+.. _Django 0.96 documentation: http://www.djangoproject.com/documentation/0.96/model-api/#floatfield
``ImageField``
~~~~~~~~~~~~~~
@@ -743,7 +760,7 @@ relationship should work. All are optional:
``limit_choices_to`` A dictionary of lookup arguments and values (see
the `Database API reference`_) that limit the
available admin choices for this object. Use this
- with functions from the Python ``datetime`` module
+ with functions from the Python ``datetime`` module
to limit choices of objects by date. For example::
limit_choices_to = {'pub_date__lte': datetime.now}
diff --git a/docs/newforms.txt b/docs/newforms.txt
index 5516f60683..7ec4e9560c 100644
--- a/docs/newforms.txt
+++ b/docs/newforms.txt
@@ -1253,10 +1253,11 @@ the full list of conversions:
``CommaSeparatedIntegerField`` ``CharField``
``DateField`` ``DateField``
``DateTimeField`` ``DateTimeField``
+ ``DecimalField`` ``DecimalField``
``EmailField`` ``EmailField``
``FileField`` ``CharField``
``FilePathField`` ``CharField``
- ``FloatField`` ``CharField``
+ ``FloatField`` ``FloatField``
``ForeignKey`` ``ModelChoiceField`` (see below)
``ImageField`` ``CharField``
``IntegerField`` ``IntegerField``
@@ -1281,6 +1282,11 @@ the full list of conversions:
``XMLField`` ``CharField`` with ``widget=Textarea``
=============================== ========================================
+
+.. note::
+ The ``FloatField`` form field and ``DecimalField`` model and form fields
+ are new in the development version.
+
As you might expect, the ``ForeignKey`` and ``ManyToManyField`` model field
types are special cases:
diff --git a/docs/tutorial02.txt b/docs/tutorial02.txt
index 6e4b0ea35e..99f586b4a1 100644
--- a/docs/tutorial02.txt
+++ b/docs/tutorial02.txt
@@ -320,7 +320,7 @@ method a ``short_description`` attribute::
Let's add another improvement to the Poll change list page: Filters. Add the
-following line to ``Poll.admin``::
+following line to ``Poll.Admin``::
list_filter = ['pub_date']