summaryrefslogtreecommitdiff
path: root/docs/ref/models
diff options
context:
space:
mode:
authorAkis Kesoglou <akis@radial.gr>2014-03-07 13:56:28 +0200
committerRamiro Morales <cramm0@gmail.com>2014-03-11 19:33:04 -0300
commitaaad3e27ac7cfcbbfeac6353d17d27e8da523cc8 (patch)
tree551dcf8b74b5fd3b00ee8b0b0b306baf8f305b84 /docs/ref/models
parentf4d91638fc4ab126ee9a269552511f5963ee61b4 (diff)
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.
Diffstat (limited to 'docs/ref/models')
-rw-r--r--docs/ref/models/fields.txt11
1 files changed, 6 insertions, 5 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index ab24dd7e66..39af0c64b0 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -1353,11 +1353,11 @@ that control how the relationship functions.
class Group(models.Model):
name = models.CharField(max_length=128)
- members = models.ManyToManyField(Person, through='Membership', through_fields=('person', 'group'))
+ members = models.ManyToManyField(Person, through='Membership', through_fields=('group', 'person'))
class Membership(models.Model):
- person = models.ForeignKey(Person)
group = models.ForeignKey(Group)
+ person = models.ForeignKey(Person)
inviter = models.ForeignKey(Person, related_name="membership_invites")
invite_reason = models.CharField(max_length=64)
@@ -1368,9 +1368,10 @@ that control how the relationship functions.
above.
``through_fields`` accepts a 2-tuple ``('field1', 'field2')``, where
- ``field1`` is the name of the foreign key to the target model (``person``
- in this case), and ``field2`` the name of the foreign key to the model the
- :class:`ManyToManyField` is defined on (``group`` in this case).
+ ``field1`` is the name of the foreign key to the model the
+ :class:`ManyToManyField` is defined on (``group`` in this case), and
+ ``field2`` the name of the foreign key to the target model (``person``
+ in this case).
When you have more than one foreign key on an intermediary model to any
(or even both) of the models participating in a many-to-many relationship,