Skip to content

Commit

Permalink
[1.7.x] Fixed #24456 -- Added links to topics/forms/modelforms.txt.
Browse files Browse the repository at this point in the history
Backport of 866e711 from master
  • Loading branch information
Psilo Cybin authored and timgraham committed Mar 10, 2015
1 parent 7a08c96 commit 6819cab
Showing 1 changed file with 40 additions and 35 deletions.
75 changes: 40 additions & 35 deletions docs/topics/forms/modelforms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:

=============================== ========================================
Model field Form field
=============================== ========================================
``AutoField`` Not represented in the form
.. currentmodule:: django.db.models

``BigIntegerField`` ``IntegerField`` with ``min_value`` set
to -9223372036854775808 and ``max_value``
set to 9223372036854775807.
=================================== ==================================================
Model field Form field
=================================== ==================================================
:class:`AutoField` Not represented in the form

``BooleanField`` ``BooleanField``
:class:`BigIntegerField` :class:`~django.forms.IntegerField` with
``min_value`` set to -9223372036854775808
and ``max_value`` set to 9223372036854775807.

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

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

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

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

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

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

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

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

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

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

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

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

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

``GenericIPAddressField`` ``GenericIPAddressField``
``IPAddressField`` ``IPAddressField``

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

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

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

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

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

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

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

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

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

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

.. currentmodule:: django.forms

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

0 comments on commit 6819cab

Please sign in to comment.