From 20e3ae5222405d0ec72704a38e80235f725728ee Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 11 Aug 2007 12:10:23 +0000 Subject: [PATCH] Fixed #4987 -- Added documentation for newforms.DecimalField. Based on a patch from james_027@yahoo.com. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5855 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- AUTHORS | 1 + docs/newforms.txt | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/AUTHORS b/AUTHORS index 9f54475150..d2f303c12b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -141,6 +141,7 @@ answer newbie questions, and generally made Django that much better: Hyun Mi Ae Tom Insam Baurzhan Ismagulov + james_027@yahoo.com jcrasta@gmail.com Zak Johnson Michael Josephson diff --git a/docs/newforms.txt b/docs/newforms.txt index 4be0fe492b..800c13b52a 100644 --- a/docs/newforms.txt +++ b/docs/newforms.txt @@ -1129,6 +1129,24 @@ If no ``input_formats`` argument is provided, the default input formats are:: '%m/%d/%y %H:%M', # '10/25/06 14:30' '%m/%d/%y', # '10/25/06' +``DecimalField`` +~~~~~~~~~~~~~~~~ + +**New in Django development version** + + * Default widget: ``TextInput`` + * Empty value: ``None`` + * Normalizes to: A Python ``decimal``. + * Validates that the given value is a decimal. Leading and trailing + whitespace is ignored. + +Takes four optional arguments: ``max_value``, ``min_value``, ``max_digits``, +and ``decimal_places``. The first two define the limits for the fields value. +``max_digits`` is the maximum number of digits (those before the decimal +point plus those after the decimal point, with leading zeros stripped) +permitted in the value, whilst ``decimal_places`` is the maximum number of +decimal places permitted. + ``EmailField`` ~~~~~~~~~~~~~~ @@ -1199,6 +1217,9 @@ When you use a ``FileField`` on a form, you must also remember to * Validates that the given value is an integer. Leading and trailing whitespace is allowed, as in Python's ``int()`` function. +Takes two optional arguments for validation, ``max_value`` and ``min_value``. +These control the range of values permitted in the field. + ``MultipleChoiceField`` ~~~~~~~~~~~~~~~~~~~~~~~