Opened 11 years ago
Closed 11 years ago
#20970 closed Cleanup/optimization (fixed)
Related fields docs improvements
Reported by: | Anssi Kääriäinen | Owned by: | Matthew Rich |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | afraid-to-commit |
Cc: | matthew@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The docs at https://docs.djangoproject.com/en/dev/ref/models/relations/ say that "In the example above, e.save() is called to perform the update." However, the example above doesn't contain .save() call at all.
In addition it might be worth it to note that all of the methods apply the change to the database instantly.
Still, I don't see a mention of direct association, that is e.entry_set = some_list. This is often the fastest way to update a relationship.
Creating separate patches for these issues might be better than doing them all in one go.
Change History (8)
comment:1 by , 11 years ago
comment:3 by , 11 years ago
Keywords: | afraid-to-commit added |
---|
So improvements still in order include:
- a mention of direct association, that is e.entry_set = some_list, which is often the fastest way to update a relationship.
- a note that all the methods discussed -
add
,create
,remove
,clear
- apply database changes immediately
comment:4 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 11 years ago
Cc: | added |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Pull request submitted.
comment:7 by , 11 years ago
Has patch: | set |
---|---|
Resolution: | fixed |
Status: | closed → new |
Please don't mark tickets as fixed until a fix is actually merged in the master branch; use the "has patch" flag instead. Thank you!
comment:8 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
What's meant by the first sentence is that when you execute
b.entry_set.add(e)
, Django callse.save()
to perform the update. I guess this can be clarified if it isn't clear.