Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Explicitly document the value range of all integer fields. #1949

Closed
wants to merge 1 commit into from

1 participant

@alimony

This will add an explicit mention of the exact value ranges for integer
type fields that are safe in all databases supported by Django. Also,
put all value numbers inside double ticks.

@alimony alimony Fixed #21427 -- Clearly state integer field value ranges in docs
Added an explicit mention of the exact value ranges for integer type
fields that are safe in all databases supported by Django. Also, put
all value numbers inside double ticks.
5f5ca30
@alimony alimony closed this
@alimony alimony deleted the alimony:docs_integer_fields_values branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 21, 2013
  1. @alimony

    Fixed #21427 -- Clearly state integer field value ranges in docs

    alimony authored
    Added an explicit mention of the exact value ranges for integer type
    fields that are safe in all databases supported by Django. Also, put
    all value numbers inside double ticks.
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 10 deletions.
  1. +13 −10 docs/ref/models/fields.txt
View
23 docs/ref/models/fields.txt
@@ -366,8 +366,9 @@ otherwise. See :ref:`automatic-primary-key-fields`.
.. class:: BigIntegerField([**options])
A 64 bit integer, much like an :class:`IntegerField` except that it is
-guaranteed to fit numbers from -9223372036854775808 to 9223372036854775807. The
-default form widget for this field is a :class:`~django.forms.TextInput`.
+guaranteed to fit numbers from ``-9223372036854775808`` to
+``9223372036854775807``. The default form widget for this field is a
+:class:`~django.forms.TextInput`.
``BinaryField``
-------------------
@@ -505,8 +506,8 @@ A fixed-precision decimal number, represented in Python by a
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::
+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)
@@ -843,7 +844,8 @@ length using the :attr:`~CharField.max_length` argument.
.. class:: IntegerField([**options])
-An integer. The default form widget for this field is a
+An integer. Values from ``-2147483648`` to ``2147483647`` are safe in all
+databases supported by Django. The default form widget for this field is a
:class:`~django.forms.TextInput`.
``IPAddressField``
@@ -904,7 +906,8 @@ widget for this field is a :class:`~django.forms.NullBooleanSelect`.
.. class:: PositiveIntegerField([**options])
Like an :class:`IntegerField`, but must be either positive or zero (``0``).
-The value ``0`` is accepted for backward compatibility reasons.
+Values from ``0`` to ``2147483647`` are safe in all databases supported by
+Django. The value ``0`` is accepted for backward compatibility reasons.
``PositiveSmallIntegerField``
-----------------------------
@@ -912,8 +915,8 @@ The value ``0`` is accepted for backward compatibility reasons.
.. class:: PositiveSmallIntegerField([**options])
Like a :class:`PositiveIntegerField`, but only allows values under a certain
-(database-dependent) point. Values up to 32767 are safe in all databases
-supported by Django.
+(database-dependent) point. Values from ``0`` to ``32767`` are safe in all
+databases supported by Django.
``SlugField``
-------------
@@ -941,8 +944,8 @@ of some other value. You can do this automatically in the admin using
.. class:: SmallIntegerField([**options])
Like an :class:`IntegerField`, but only allows values under a certain
-(database-dependent) point. Values from -32768 to 32767 are safe in all databases
-supported by Django.
+(database-dependent) point. Values from ``-32768`` to ``32767``` are safe in all
+databases supported by Django.
``TextField``
-------------
Something went wrong with that request. Please try again.