mirror of https://github.com/django/django.git
Fixed #31310 -- Fixed hints in checks for using intermediate model with ambiguous foreign key.
symmetrical=False is not required since
87b1ad6e73
.
This commit is contained in:
parent
308fab9241
commit
e908eb6287
|
@ -1309,7 +1309,7 @@ class ManyToManyField(RelatedField):
|
||||||
"through_fields keyword argument.") % (self, from_model_name),
|
"through_fields keyword argument.") % (self, from_model_name),
|
||||||
hint=(
|
hint=(
|
||||||
'If you want to create a recursive relationship, '
|
'If you want to create a recursive relationship, '
|
||||||
'use ForeignKey("%s", symmetrical=False, through="%s").'
|
'use ManyToManyField("%s", through="%s").'
|
||||||
) % (
|
) % (
|
||||||
RECURSIVE_RELATIONSHIP_CONSTANT,
|
RECURSIVE_RELATIONSHIP_CONSTANT,
|
||||||
relationship_model_name,
|
relationship_model_name,
|
||||||
|
@ -1329,7 +1329,7 @@ class ManyToManyField(RelatedField):
|
||||||
"through_fields keyword argument." % (self, to_model_name),
|
"through_fields keyword argument." % (self, to_model_name),
|
||||||
hint=(
|
hint=(
|
||||||
'If you want to create a recursive relationship, '
|
'If you want to create a recursive relationship, '
|
||||||
'use ForeignKey("%s", symmetrical=False, through="%s").'
|
'use ManyToManyField("%s", through="%s").'
|
||||||
) % (
|
) % (
|
||||||
RECURSIVE_RELATIONSHIP_CONSTANT,
|
RECURSIVE_RELATIONSHIP_CONSTANT,
|
||||||
relationship_model_name,
|
relationship_model_name,
|
||||||
|
|
|
@ -150,15 +150,14 @@ class RelativeFieldTests(SimpleTestCase):
|
||||||
"through_fields keyword argument.",
|
"through_fields keyword argument.",
|
||||||
hint=(
|
hint=(
|
||||||
'If you want to create a recursive relationship, use '
|
'If you want to create a recursive relationship, use '
|
||||||
'ForeignKey("self", symmetrical=False, '
|
'ManyToManyField("self", through="AmbiguousRelationship").'
|
||||||
'through="AmbiguousRelationship").'
|
|
||||||
),
|
),
|
||||||
obj=field,
|
obj=field,
|
||||||
id='fields.E334',
|
id='fields.E334',
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
|
|
||||||
def test_ambiguous_relationship_model(self):
|
def test_ambiguous_relationship_model_to(self):
|
||||||
|
|
||||||
class Person(models.Model):
|
class Person(models.Model):
|
||||||
pass
|
pass
|
||||||
|
@ -182,7 +181,7 @@ class RelativeFieldTests(SimpleTestCase):
|
||||||
"keyword argument.",
|
"keyword argument.",
|
||||||
hint=(
|
hint=(
|
||||||
'If you want to create a recursive relationship, use '
|
'If you want to create a recursive relationship, use '
|
||||||
'ForeignKey("self", symmetrical=False, through="AmbiguousRelationship").'
|
'ManyToManyField("self", through="AmbiguousRelationship").'
|
||||||
),
|
),
|
||||||
obj=field,
|
obj=field,
|
||||||
id='fields.E335',
|
id='fields.E335',
|
||||||
|
|
Loading…
Reference in New Issue