diff options
| author | Tim Graham <timograham@gmail.com> | 2015-10-13 06:08:27 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-10-14 05:21:08 -0700 |
| commit | c7aff31397a7228f6ac2e33c10ebdf36c4b7a9b7 (patch) | |
| tree | a034b8762c029ef9f9b42ceef248081664220673 /django | |
| parent | 92c1ae1b0b9955a511c19e07921c10126b6faa54 (diff) | |
Refs #25535 -- Minor edits to ForeignObject check changes.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/fields/related.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 74a7a3e595..ef3de8f139 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -474,7 +474,6 @@ class ForeignObject(RelatedField): for ut in self.remote_field.model._meta.unique_together }) foreign_fields = {f.name for f in self.foreign_related_fields} - has_unique_constraint = any(u <= foreign_fields for u in unique_foreign_fields) if not has_unique_constraint and len(self.foreign_related_fields) > 1: @@ -483,11 +482,12 @@ class ForeignObject(RelatedField): model_name = self.remote_field.model.__name__ return [ checks.Error( - "No subset of the fields %s on model '%s' is unique" + "No subset of the fields %s on model '%s' is unique." % (field_combination, model_name), - hint="Add a unique=True on any of the fields %s of '%s', or add them all or a " - "subset to a unique_together constraint." - % (field_combination, model_name), + hint=( + "Add unique=True on any of those fields or add at " + "least a subset of them to a unique_together constraint." + ), obj=self, id='fields.E310', ) |
