1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #22047 -- detecting related_name clash with inheritance

Thanks to mondone for fruitful colaboration.
This commit is contained in:
Christopher Medrela
2014-02-15 15:36:07 +01:00
committed by Baptiste Mispelon
parent 65b421c661
commit d0133504e5
2 changed files with 30 additions and 1 deletions

View File

@@ -183,7 +183,7 @@ class RelatedField(Field):
# Check clashes between accessor or reverse query name of `field`
# and any other field name -- i. e. accessor for Model.foreign is
# model_set and it clashes with Target.model_set.
potential_clashes = rel_opts.fields + rel_opts.local_many_to_many
potential_clashes = rel_opts.fields + rel_opts.many_to_many
for clash_field in potential_clashes:
clash_name = "%s.%s" % (rel_opts.object_name,
clash_field.name) # i. e. "Target.model_set"