diff options
| author | Michael Scott <michael.scott250@gmail.com> | 2016-09-20 22:31:23 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-10-28 20:11:03 -0400 |
| commit | ec9ed07488aa46fa9d9fd70ed99e82fdf184632a (patch) | |
| tree | c080eab116a5788deb0cdb93b82739f7ddf92d0c /docs/ref | |
| parent | 625cd5bcb315154ed28061fefaf639aff54da7c2 (diff) | |
Fixed #27188 -- Allowed using unique=True with FileField.
Thanks Tim Graham for the initial patch.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/checks.txt | 1 | ||||
| -rw-r--r-- | docs/ref/models/fields.txt | 12 |
2 files changed, 9 insertions, 4 deletions
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt index f71a1882be..638f9af564 100644 --- a/docs/ref/checks.txt +++ b/docs/ref/checks.txt @@ -183,6 +183,7 @@ File Fields ~~~~~~~~~~~ * **fields.E200**: ``unique`` is not a valid argument for a ``FileField``. + *This check is removed in Django 1.11*. * **fields.E201**: ``primary_key`` is not a valid argument for a ``FileField``. * **fields.E210**: Cannot use ``ImageField`` because Pillow is not installed. diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index df96fbf827..6c9c5057c2 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -306,12 +306,16 @@ you try to save a model with a duplicate value in a :attr:`~Field.unique` field, a :exc:`django.db.IntegrityError` will be raised by the model's :meth:`~django.db.models.Model.save` method. -This option is valid on all field types except :class:`ManyToManyField`, -:class:`OneToOneField`, and :class:`FileField`. +This option is valid on all field types except :class:`ManyToManyField` and +:class:`OneToOneField`. Note that when ``unique`` is ``True``, you don't need to specify :attr:`~Field.db_index`, because ``unique`` implies the creation of an index. +.. versionchanged:: 1.11 + + In older versions, ``unique=True`` can't be used on :class:`FileField`. + ``unique_for_date`` ------------------- @@ -628,8 +632,8 @@ uses :class:`~django.core.validators.EmailValidator` to validate the input. A file-upload field. .. note:: - The ``primary_key`` and ``unique`` arguments are not supported, and will - raise a ``TypeError`` if used. + The ``primary_key`` argument isn't supported and will raise a an error if + used. Has two optional arguments: |
