mirror of
				https://github.com/django/django.git
				synced 2025-10-26 07:06:08 +00:00 
			
		
		
		
	Merge pull request #4271 from PsiloLR/ticket_24456
Fixed #24456 -- Update modelforms.txt table of Form/Model refs
This commit is contained in:
		| @@ -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 | Model field                         Form field | ||||||
| ===============================  ======================================== | =================================== ================================================== | ||||||
| ``AutoField``                    Not represented in the form | :class:`AutoField`                  Not represented in the form | ||||||
|  |  | ||||||
| ``BigIntegerField``              ``IntegerField`` with ``min_value`` set | :class:`BigIntegerField`            :class:`IntegerField` with ``min_value`` | ||||||
|                                  to -9223372036854775808 and ``max_value`` |                                     set to -9223372036854775808 and | ||||||
|                                  set to 9223372036854775807. |                                     ``max_value`` set to 9223372036854775807. | ||||||
|  |  | ||||||
| ``BooleanField``                 ``BooleanField`` | :class:`BooleanField`               :class:`~django.forms.BooleanField` | ||||||
|  |  | ||||||
| ``CharField``                    ``CharField`` with ``max_length`` set to | :class:`CharField`                  :class:`~django.forms.CharField` with  | ||||||
|                                  the model field's ``max_length`` |                                     ``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`` | ``IPAddressField``                  ``IPAddressField`` | ||||||
|  |  | ||||||
| ``GenericIPAddressField``        ``GenericIPAddressField`` | :class:`GenericIPAddressField`      :class:`~django.forms.GenericIPAddressField` | ||||||
|  |  | ||||||
| ``ManyToManyField``              ``ModelMultipleChoiceField`` (see | :class:`ManyToManyField`            :class:`~django.forms.ModelMultipleChoiceField`  | ||||||
|                                  below) |                                     (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`` |                                     ``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 | As you might expect, the ``ForeignKey`` and ``ManyToManyField`` model field | ||||||
| types are special cases: | types are special cases: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user