summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2018-05-03 15:28:37 +0200
committerGitHub <noreply@github.com>2018-05-03 15:28:37 +0200
commit21fd8041c163eafc0a6bfad0efc8e98693580622 (patch)
tree133274cf3d7c4ab76e2eee837a77026d96c84184
parent816b8d9518c41f034dcbacfd1f1826f2366975e5 (diff)
Refs #29358 -- Corrected wording in primary key check message.
-rw-r--r--django/db/models/base.py3
-rw-r--r--docs/ref/checks.txt3
-rw-r--r--tests/invalid_models_tests/test_models.py2
3 files changed, 5 insertions, 3 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 3573838b99..fe8e7d3b0a 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1443,7 +1443,8 @@ class Model(metaclass=ModelBase):
if sum(1 for f in cls._meta.local_fields if f.primary_key) > 1:
errors.append(
checks.Error(
- "Model can not contain more than one 'primary_key' field.",
+ "The model cannot have more than one field with "
+ "'primary_key=True'.",
obj=cls,
id='models.E026',
)
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt
index 9690b5a99b..a85c6b4e6e 100644
--- a/docs/ref/checks.txt
+++ b/docs/ref/checks.txt
@@ -295,7 +295,8 @@ Models
as it collides with the query lookup syntax.
* **models.E025**: The property ``<property name>`` clashes with a related
field accessor.
-* **models.E026**: Model can not contain more than one ``primary_key`` field.
+* **models.E026**: The model cannot have more than one field with
+ ``primary_key=True``.
Security
--------
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index 2066d4ebae..19ec21c9ae 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -724,7 +724,7 @@ class OtherModelTests(SimpleTestCase):
self.assertEqual(Model.check(), [
Error(
- "Model can not contain more than one 'primary_key' field.",
+ "The model cannot have more than one field with 'primary_key=True'.",
obj=Model,
id='models.E026',
)