Fixed #24456 -- Update modelforms.txt table of Form/Model refs

Added links to the Form/Model table to the field reference docs to
point to their individual field references
This commit is contained in:
Psilo Cybin 2015-03-07 15:15:21 +01:00 committed by PsiloLR
parent 9eab328444
commit 866e71140f
1 changed files with 40 additions and 35 deletions

View File

@ -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 ``ManyToManyField`` is represented as a ``MultipleChoiceField``. Here is the
full list of conversions: full list of conversions:
=============================== ======================================== .. currentmodule:: django.db.models
Model field Form field
=============================== ========================================
``AutoField`` Not represented in the form
``BigIntegerField`` ``IntegerField`` with ``min_value`` set =================================== ==================================================
to -9223372036854775808 and ``max_value`` Model field Form field
set to 9223372036854775807. =================================== ==================================================
:class:`AutoField` Not represented in the form
``BooleanField`` ``BooleanField`` :class:`BigIntegerField` :class:`IntegerField` with ``min_value``
set to -9223372036854775808 and
``max_value`` set to 9223372036854775807.
``CharField`` ``CharField`` with ``max_length`` set to :class:`BooleanField` :class:`~django.forms.BooleanField`
the model field's ``max_length``
``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 :class:`GenericIPAddressField` :class:`~django.forms.GenericIPAddressField`
below)
``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 :class:`SmallIntegerField` :class:`~django.forms.IntegerField`
``widget=forms.Textarea``
``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 As you might expect, the ``ForeignKey`` and ``ManyToManyField`` model field
types are special cases: types are special cases: