Commit 180f75c2 authored by Daniele Procida's avatar Daniele Procida
Browse files

Merge pull request #4271 from PsiloLR/ticket_24456

Fixed #24456 -- Update modelforms.txt table of Form/Model refs
parents e42a720b 866e7114
Loading
Loading
Loading
Loading
+40 −35
Original line number Diff line number Diff line
@@ -49,67 +49,72 @@ Each model field has a corresponding default form field. For example, a
``ManyToManyField`` is represented as a ``MultipleChoiceField``. Here is the
full list of conversions:

===============================  ========================================
.. currentmodule:: django.db.models

=================================== ==================================================
Model field                         Form field
===============================  ========================================
``AutoField``                    Not represented in the form
=================================== ==================================================
:class:`AutoField`                  Not represented in the form

``BigIntegerField``              ``IntegerField`` with ``min_value`` set
                                 to -9223372036854775808 and ``max_value``
                                 set to 9223372036854775807.
:class:`BigIntegerField`            :class:`IntegerField` with ``min_value``
                                    set to -9223372036854775808 and
                                    ``max_value`` set to 9223372036854775807.

``BooleanField``                 ``BooleanField``
:class:`BooleanField`               :class:`~django.forms.BooleanField`

``CharField``                    ``CharField`` with ``max_length`` set to
                                 the model field's ``max_length``
:class:`CharField`                  :class:`~django.forms.CharField` with 
                                    ``max_length`` set to the model field's 
                                    ``max_length``

``CommaSeparatedIntegerField``   ``CharField``
:class:`CommaSeparatedIntegerField` :class:`~django.forms.CharField`

``DateField``                    ``DateField``
:class:`DateField`                  :class:`~django.forms.DateField`

``DateTimeField``                ``DateTimeField``
:class:`DateTimeField`              :class:`~django.forms.DateTimeField`

``DecimalField``                 ``DecimalField``
:class:`DecimalField`               :class:`~django.forms.DecimalField`

``EmailField``                   ``EmailField``
:class:`EmailField`                 :class:`~django.forms.EmailField`

``FileField``                    ``FileField``
:class:`FileField`                  :class:`~django.forms.FileField`

``FilePathField``                ``FilePathField``
:class:`FilePathField`              :class:`~django.forms.FilePathField`

``FloatField``                   ``FloatField``
:class:`FloatField`                 :class:`~django.forms.FloatField`

``ForeignKey``                   ``ModelChoiceField`` (see below)
:class:`ForeignKey`                 :class:`~django.forms.ModelChoiceField` 
                                    (see below)

``ImageField``                   ``ImageField``
``ImageField``                      :class:`~django.forms.ImageField`

``IntegerField``                 ``IntegerField``
:class:`IntegerField`               :class:`~django.forms.IntegerField`

``IPAddressField``                  ``IPAddressField``

``GenericIPAddressField``        ``GenericIPAddressField``
:class:`GenericIPAddressField`      :class:`~django.forms.GenericIPAddressField`

``ManyToManyField``              ``ModelMultipleChoiceField`` (see
                                 below)
:class:`ManyToManyField`            :class:`~django.forms.ModelMultipleChoiceField` 
                                    (see below)

``NullBooleanField``             ``CharField``
:class:`NullBooleanField`           :class:`~django.forms.CharField`

``PositiveIntegerField``         ``IntegerField``
:class:`PositiveIntegerField`       :class:`~django.forms.IntegerField`

``PositiveSmallIntegerField``    ``IntegerField``
:class:`PositiveSmallIntegerField`  :class:`~django.forms.IntegerField`

``SlugField``                    ``SlugField``
:class:`SlugField`                  :class:`~django.forms.SlugField`

``SmallIntegerField``            ``IntegerField``
:class:`SmallIntegerField`          :class:`~django.forms.IntegerField`

``TextField``                    ``CharField`` with
:class:`TextField`                  :class:`~django.forms.CharField` with
                                    ``widget=forms.Textarea``

``TimeField``                    ``TimeField``
:class:`TimeField`                  :class:`~django.forms.TimeField`

``URLField``                     ``URLField``
===============================  ========================================
:class:`URLField`                   :class:`~django.forms.URLField`
=================================== ==================================================

.. currentmodule:: django.forms

As you might expect, the ``ForeignKey`` and ``ManyToManyField`` model field
types are special cases: