1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #32983 -- Added system check for redundant related_name on symmetrical M2M fields.

Since ManyToManyFields defined with `symmetrical=True` do not add a
related field to the target model, including a `related_name` argument
will never do what the coder likely expects. This makes including
a related_name with a symmetrical model raise a system check warning.

ticket-32983
This commit is contained in:
Nick Touran
2021-08-04 13:19:29 -07:00
committed by Carlton Gibson
parent 1fb21ab377
commit 5d4f21b16f
3 changed files with 26 additions and 0 deletions

View File

@@ -313,6 +313,8 @@ Related fields
with a ``through`` model.
* **fields.W344**: The field's intermediary table ``<table name>`` clashes with
the table name of ``<model>``/``<model>.<field name>``.
* **fields.W345**: ``related_name`` has no effect on ``ManyToManyField`` with a
symmetrical relationship, e.g. to "self".
Models
------