1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.9.x] Fixed #25535 -- Made ForeignObject checks less strict.

Check that the foreign object `from_fields` are a subset of any unique
constraints on the foreign model.

Backport of 80dac8c33e and
c7aff31397 from master
This commit is contained in:
Antoine Catton
2015-10-09 10:55:19 -06:00
committed by Tim Graham
parent aa0a3b680e
commit 38d6e1e2ad
4 changed files with 154 additions and 12 deletions

View File

@@ -189,8 +189,9 @@ Related Fields
for ``<field name>``.
* **fields.E306**: Related name must be a valid Python identifier or end with
a ``'+'``.
* **fields.E310**: None of the fields ``<field1>``, ``<field2>``, ... on model
``<model>`` have a ``unique=True`` constraint.
* **fields.E310**: No subset of the fields ``<field1>``, ``<field2>``, ... on
model ``<model>`` is unique. Add ``unique=True`` on any of those fields or
add at least a subset of them to a unique_together constraint.
* **fields.E311**: ``<model>`` must set ``unique=True`` because it is
referenced by a ``ForeignKey``.
* **fields.E320**: Field specifies ``on_delete=SET_NULL``, but cannot be null.