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 Tim Graham, 11 years ago

What's meant by the first sentence is that when you execute b.entry_set.add(e), Django calls e.save() to perform the update. I guess this can be clarified if it isn't clear.

comment:2 by Anssi Kääriäinen, 11 years ago

Nah, no need to do that, I just didn't manage to read that correctly.

comment:3 by Daniele Procida, 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 Matthew Rich, 11 years ago

Owner: changed from nobody to Matthew Rich
Status: newassigned

comment:5 by Matthew Rich, 11 years ago

Tackling this ticket at Djangocon sprints.

comment:6 by Matthew Rich, 11 years ago

Cc: matthew@… added
Resolution: fixed
Status: assignedclosed

Pull request submitted.

comment:7 by Aymeric Augustin, 11 years ago

Has patch: set
Resolution: fixed
Status: closednew

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 Tim Graham, 11 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top