summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/models/fields/related.py4
-rw-r--r--tests/invalid_models_tests/test_relative_fields.py7
2 files changed, 5 insertions, 6 deletions
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index 8ddbb5ba68..536b3dd601 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -1309,7 +1309,7 @@ class ManyToManyField(RelatedField):
"through_fields keyword argument.") % (self, from_model_name),
hint=(
'If you want to create a recursive relationship, '
- 'use ForeignKey("%s", symmetrical=False, through="%s").'
+ 'use ManyToManyField("%s", through="%s").'
) % (
RECURSIVE_RELATIONSHIP_CONSTANT,
relationship_model_name,
@@ -1329,7 +1329,7 @@ class ManyToManyField(RelatedField):
"through_fields keyword argument." % (self, to_model_name),
hint=(
'If you want to create a recursive relationship, '
- 'use ForeignKey("%s", symmetrical=False, through="%s").'
+ 'use ManyToManyField("%s", through="%s").'
) % (
RECURSIVE_RELATIONSHIP_CONSTANT,
relationship_model_name,
diff --git a/tests/invalid_models_tests/test_relative_fields.py b/tests/invalid_models_tests/test_relative_fields.py
index a23e8bf044..7e32cced60 100644
--- a/tests/invalid_models_tests/test_relative_fields.py
+++ b/tests/invalid_models_tests/test_relative_fields.py
@@ -150,15 +150,14 @@ class RelativeFieldTests(SimpleTestCase):
"through_fields keyword argument.",
hint=(
'If you want to create a recursive relationship, use '
- 'ForeignKey("self", symmetrical=False, '
- 'through="AmbiguousRelationship").'
+ 'ManyToManyField("self", through="AmbiguousRelationship").'
),
obj=field,
id='fields.E334',
),
])
- def test_ambiguous_relationship_model(self):
+ def test_ambiguous_relationship_model_to(self):
class Person(models.Model):
pass
@@ -182,7 +181,7 @@ class RelativeFieldTests(SimpleTestCase):
"keyword argument.",
hint=(
'If you want to create a recursive relationship, use '
- 'ForeignKey("self", symmetrical=False, through="AmbiguousRelationship").'
+ 'ManyToManyField("self", through="AmbiguousRelationship").'
),
obj=field,
id='fields.E335',