mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #22217 - ManyToManyField.through_fields fixes.
- Docs description of arguments mix up. - Keep it from erroneously masking E332 check. - Add checks E338 and E339, tweak message of E337.
This commit is contained in:
parent
f4d91638fc
commit
aaad3e27ac
5 changed files with 154 additions and 49 deletions
|
@ -440,12 +440,12 @@ explicit declaration defines how the two models are related.
|
|||
There are a few restrictions on the intermediate model:
|
||||
|
||||
* Your intermediate model must contain one - and *only* one - foreign key
|
||||
to the target model (this would be ``Person`` in our example), or you must
|
||||
to the source model (this would be ``Group`` in our example), or you must
|
||||
explicitly specify the foreign keys Django should use for the relationship
|
||||
using :attr:`ManyToManyField.through_fields <ManyToManyField.through_fields>`.
|
||||
If you have more than one foreign key and ``through_fields`` is not
|
||||
specified, a validation error will be raised. A similar restriction applies
|
||||
to the foreign key to the source model (this would be ``Group`` in our
|
||||
to the foreign key to the target model (this would be ``Person`` in our
|
||||
example).
|
||||
|
||||
* For a model which has a many-to-many relationship to itself through an
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue