|
@@ -396,7 +396,7 @@ otherwise. See :ref:`automatic-primary-key-fields`.
|
|
|
``BigIntegerField``
|
|
|
-------------------
|
|
|
|
|
|
-.. class:: BigIntegerField([**options])
|
|
|
+.. class:: BigIntegerField(**options)
|
|
|
|
|
|
A 64 bit integer, much like an :class:`IntegerField` except that it is
|
|
|
guaranteed to fit numbers from ``-9223372036854775808`` to
|
|
@@ -406,7 +406,7 @@ guaranteed to fit numbers from ``-9223372036854775808`` to
|
|
|
``BinaryField``
|
|
|
-------------------
|
|
|
|
|
|
-.. class:: BinaryField([**options])
|
|
|
+.. class:: BinaryField(**options)
|
|
|
|
|
|
A field to store raw binary data. It only supports ``bytes`` assignment. Be
|
|
|
aware that this field has limited functionality. For example, it is not possible
|
|
@@ -437,7 +437,7 @@ isn't defined.
|
|
|
``CharField``
|
|
|
-------------
|
|
|
|
|
|
-.. class:: CharField(max_length=None, [**options])
|
|
|
+.. class:: CharField(max_length=None, **options)
|
|
|
|
|
|
A string field, for small- to large-sized strings.
|
|
|
|
|
@@ -470,7 +470,7 @@ The default form widget for this field is a :class:`~django.forms.TextInput`.
|
|
|
``CommaSeparatedIntegerField``
|
|
|
------------------------------
|
|
|
|
|
|
-.. class:: CommaSeparatedIntegerField(max_length=None, [**options])
|
|
|
+.. class:: CommaSeparatedIntegerField(max_length=None, **options)
|
|
|
|
|
|
A field of integers separated by commas. As in :class:`CharField`, the
|
|
|
:attr:`~CharField.max_length` argument is required and the note about database
|
|
@@ -479,7 +479,7 @@ portability mentioned there should be heeded.
|
|
|
``DateField``
|
|
|
-------------
|
|
|
|
|
|
-.. class:: DateField([auto_now=False, auto_now_add=False, **options])
|
|
|
+.. class:: DateField(auto_now=False, auto_now_add=False, **options)
|
|
|
|
|
|
A date, represented in Python by a ``datetime.date`` instance. Has a few extra,
|
|
|
optional arguments:
|
|
@@ -525,7 +525,7 @@ Any combination of these options will result in an error.
|
|
|
``DateTimeField``
|
|
|
-----------------
|
|
|
|
|
|
-.. class:: DateTimeField([auto_now=False, auto_now_add=False, **options])
|
|
|
+.. class:: DateTimeField(auto_now=False, auto_now_add=False, **options)
|
|
|
|
|
|
A date and time, represented in Python by a ``datetime.datetime`` instance.
|
|
|
Takes the same extra arguments as :class:`DateField`.
|
|
@@ -537,7 +537,7 @@ The default form widget for this field is a single
|
|
|
``DecimalField``
|
|
|
----------------
|
|
|
|
|
|
-.. class:: DecimalField(max_digits=None, decimal_places=None, [**options])
|
|
|
+.. class:: DecimalField(max_digits=None, decimal_places=None, **options)
|
|
|
|
|
|
A fixed-precision decimal number, represented in Python by a
|
|
|
:class:`~decimal.Decimal` instance. Has two **required** arguments:
|
|
@@ -576,7 +576,7 @@ when :attr:`~django.forms.Field.localize` is ``False`` or
|
|
|
|
|
|
.. versionadded:: 1.8
|
|
|
|
|
|
-.. class:: DurationField([**options])
|
|
|
+.. class:: DurationField(**options)
|
|
|
|
|
|
A field for storing periods of time - modeled in Python by
|
|
|
:class:`~python:datetime.timedelta`. When used on PostgreSQL, the data type
|
|
@@ -592,7 +592,7 @@ SECOND(6)``. Otherwise a ``bigint`` of microseconds is used.
|
|
|
``EmailField``
|
|
|
--------------
|
|
|
|
|
|
-.. class:: EmailField([max_length=254, **options])
|
|
|
+.. class:: EmailField(max_length=254, **options)
|
|
|
|
|
|
A :class:`CharField` that checks that the value is a valid email address. It
|
|
|
uses :class:`~django.core.validators.EmailValidator` to validate the input.
|
|
@@ -605,7 +605,7 @@ uses :class:`~django.core.validators.EmailValidator` to validate the input.
|
|
|
``FileField``
|
|
|
-------------
|
|
|
|
|
|
-.. class:: FileField([upload_to=None, max_length=100, **options])
|
|
|
+.. class:: FileField(upload_to=None, max_length=100, **options)
|
|
|
|
|
|
A file-upload field.
|
|
|
|
|
@@ -821,7 +821,7 @@ periodically via e.g. cron).
|
|
|
``FilePathField``
|
|
|
-----------------
|
|
|
|
|
|
-.. class:: FilePathField(path=None, [match=None, recursive=False, max_length=100, **options])
|
|
|
+.. class:: FilePathField(path=None, match=None, recursive=False, max_length=100, **options)
|
|
|
|
|
|
A :class:`CharField` whose choices are limited to the filenames in a certain
|
|
|
directory on the filesystem. Has three special arguments, of which the first is
|
|
@@ -874,7 +874,7 @@ can change the maximum length using the :attr:`~CharField.max_length` argument.
|
|
|
``FloatField``
|
|
|
--------------
|
|
|
|
|
|
-.. class:: FloatField([**options])
|
|
|
+.. class:: FloatField(**options)
|
|
|
|
|
|
A floating-point number represented in Python by a ``float`` instance.
|
|
|
|
|
@@ -896,7 +896,7 @@ when :attr:`~django.forms.Field.localize` is ``False`` or
|
|
|
``ImageField``
|
|
|
--------------
|
|
|
|
|
|
-.. class:: ImageField([upload_to=None, height_field=None, width_field=None, max_length=100, **options])
|
|
|
+.. class:: ImageField(upload_to=None, height_field=None, width_field=None, max_length=100, **options)
|
|
|
|
|
|
Inherits all attributes and methods from :class:`FileField`, but also
|
|
|
validates that the uploaded object is a valid image.
|
|
@@ -931,7 +931,7 @@ The default form widget for this field is a
|
|
|
``IntegerField``
|
|
|
----------------
|
|
|
|
|
|
-.. class:: IntegerField([**options])
|
|
|
+.. class:: IntegerField(**options)
|
|
|
|
|
|
An integer. Values from ``-2147483648`` to ``2147483647`` are safe in all
|
|
|
databases supported by Django. The default form widget for this field is a
|
|
@@ -941,7 +941,7 @@ is ``False`` or :class:`~django.forms.TextInput` otherwise.
|
|
|
``GenericIPAddressField``
|
|
|
-------------------------
|
|
|
|
|
|
-.. class:: GenericIPAddressField([protocol=both, unpack_ipv4=False, **options])
|
|
|
+.. class:: GenericIPAddressField(protocol=both, unpack_ipv4=False, **options)
|
|
|
|
|
|
An IPv4 or IPv6 address, in string format (e.g. ``192.0.2.30`` or
|
|
|
``2a02:42fe::4``). The default form widget for this field is a
|
|
@@ -972,7 +972,7 @@ values are stored as null.
|
|
|
``NullBooleanField``
|
|
|
--------------------
|
|
|
|
|
|
-.. class:: NullBooleanField([**options])
|
|
|
+.. class:: NullBooleanField(**options)
|
|
|
|
|
|
Like a :class:`BooleanField`, but allows ``NULL`` as one of the options. Use
|
|
|
this instead of a :class:`BooleanField` with ``null=True``. The default form
|
|
@@ -981,7 +981,7 @@ widget for this field is a :class:`~django.forms.NullBooleanSelect`.
|
|
|
``PositiveIntegerField``
|
|
|
------------------------
|
|
|
|
|
|
-.. class:: PositiveIntegerField([**options])
|
|
|
+.. class:: PositiveIntegerField(**options)
|
|
|
|
|
|
Like an :class:`IntegerField`, but must be either positive or zero (``0``).
|
|
|
Values from ``0`` to ``2147483647`` are safe in all databases supported by
|
|
@@ -990,7 +990,7 @@ Django. The value ``0`` is accepted for backward compatibility reasons.
|
|
|
``PositiveSmallIntegerField``
|
|
|
-----------------------------
|
|
|
|
|
|
-.. class:: PositiveSmallIntegerField([**options])
|
|
|
+.. class:: PositiveSmallIntegerField(**options)
|
|
|
|
|
|
Like a :class:`PositiveIntegerField`, but only allows values under a certain
|
|
|
(database-dependent) point. Values from ``0`` to ``32767`` are safe in all
|
|
@@ -999,7 +999,7 @@ databases supported by Django.
|
|
|
``SlugField``
|
|
|
-------------
|
|
|
|
|
|
-.. class:: SlugField([max_length=50, **options])
|
|
|
+.. class:: SlugField(max_length=50, **options)
|
|
|
|
|
|
:term:`Slug` is a newspaper term. A slug is a short label for something,
|
|
|
containing only letters, numbers, underscores or hyphens. They're generally used
|
|
@@ -1026,7 +1026,7 @@ of some other value. You can do this automatically in the admin using
|
|
|
``SmallIntegerField``
|
|
|
---------------------
|
|
|
|
|
|
-.. class:: SmallIntegerField([**options])
|
|
|
+.. 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
|
|
@@ -1035,7 +1035,7 @@ databases supported by Django.
|
|
|
``TextField``
|
|
|
-------------
|
|
|
|
|
|
-.. class:: TextField([**options])
|
|
|
+.. class:: TextField(**options)
|
|
|
|
|
|
A large text field. The default form widget for this field is a
|
|
|
:class:`~django.forms.Textarea`.
|
|
@@ -1055,7 +1055,7 @@ However it is not enforced at the model or database level. Use a
|
|
|
``TimeField``
|
|
|
-------------
|
|
|
|
|
|
-.. class:: TimeField([auto_now=False, auto_now_add=False, **options])
|
|
|
+.. class:: TimeField(auto_now=False, auto_now_add=False, **options)
|
|
|
|
|
|
A time, represented in Python by a ``datetime.time`` instance. Accepts the same
|
|
|
auto-population options as :class:`DateField`.
|
|
@@ -1066,7 +1066,7 @@ The admin adds some JavaScript shortcuts.
|
|
|
``URLField``
|
|
|
------------
|
|
|
|
|
|
-.. class:: URLField([max_length=200, **options])
|
|
|
+.. class:: URLField(max_length=200, **options)
|
|
|
|
|
|
A :class:`CharField` for a URL.
|
|
|
|
|
@@ -1081,7 +1081,7 @@ Like all :class:`CharField` subclasses, :class:`URLField` takes the optional
|
|
|
|
|
|
.. versionadded:: 1.8
|
|
|
|
|
|
-.. class:: UUIDField([**options])
|
|
|
+.. class:: UUIDField(**options)
|
|
|
|
|
|
A field for storing universally unique identifiers. Uses Python's
|
|
|
:class:`~python:uuid.UUID` class. When used on PostgreSQL, this stores in a
|
|
@@ -1116,7 +1116,7 @@ Django also defines a set of fields that represent relations.
|
|
|
``ForeignKey``
|
|
|
--------------
|
|
|
|
|
|
-.. class:: ForeignKey(othermodel, [**options])
|
|
|
+.. class:: ForeignKey(othermodel, **options)
|
|
|
|
|
|
A many-to-one relationship. Requires a positional argument: the class to which
|
|
|
the model is related.
|
|
@@ -1374,7 +1374,7 @@ The possible values for :attr:`~ForeignKey.on_delete` are found in
|
|
|
``ManyToManyField``
|
|
|
-------------------
|
|
|
|
|
|
-.. class:: ManyToManyField(othermodel, [**options])
|
|
|
+.. class:: ManyToManyField(othermodel, **options)
|
|
|
|
|
|
A many-to-many relationship. Requires a positional argument: the class to
|
|
|
which the model is related, which works exactly the same as it does for
|
|
@@ -1577,7 +1577,7 @@ relationship at the database level.
|
|
|
``OneToOneField``
|
|
|
-----------------
|
|
|
|
|
|
-.. class:: OneToOneField(othermodel, [parent_link=False, **options])
|
|
|
+.. class:: OneToOneField(othermodel, parent_link=False, **options)
|
|
|
|
|
|
A one-to-one relationship. Conceptually, this is similar to a
|
|
|
:class:`ForeignKey` with :attr:`unique=True <Field.unique>`, but the
|