Opened 12 years ago
Closed 12 years ago
#21343 closed Cleanup/optimization (fixed)
Restrictions imposed by intermediate many-to-many relationships should be mentioned in many-to-many reference docs
| Reported by: | Daniele Procida | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Normal | Keywords: | afraid-to-commit |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships mentions that "you can’t use add, create, or assignment (i.e., beatles.members = [...]) to create relationships" when using intermediate models for many-to-many relationships with through, but https://docs.djangoproject.com/en/dev/topics/db/examples/many_to_many/ doesn't, and should.
In the middle of the https://docs.djangoproject.com/en/dev/topics/db/models/#intermediary-manytomany section, there are notes about restrictions, and this probably deserves a subheading of its own.
Change History (4)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
https://docs.djangoproject.com/en/dev/ref/models/relations/ doesn't mention it either.
I think people are likely to land on those pages, and - if they are dealing with intermediate models - may be puzzled to find that add() etc don't work. Only a sentence would be required: "note that if you are using an intermediate model, some of the related manager's methods are disabled. See https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships"
comment:3 by , 12 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Type: | Uncategorized → Cleanup/optimization |
comment:4 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
IMO, extra fields on M2M relationships is an advanced topic that doesn't need to be mentioned in /topics/db/examples/many_to_many/ which seems more beginner oriented. It's not clear to me what type note or link or additional example your looking for here.