#20970 closed Cleanup/optimization (fixed)

Related fields docs improvements

Reported by: akaariai Owned by: technivore
Component: Documentation Version: master
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 Changed 20 months ago by timo

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 Changed 20 months ago by akaariai

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

comment:3 Changed 20 months ago by EvilDMP

  • 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 Changed 20 months ago by technivore

  • Owner changed from nobody to technivore
  • Status changed from new to assigned

comment:5 Changed 20 months ago by technivore

Tackling this ticket at Djangocon sprints.

comment:6 Changed 20 months ago by technivore

  • Cc matthew@… added
  • Resolution set to fixed
  • Status changed from assigned to closed

Pull request submitted.

comment:7 Changed 20 months ago by aaugustin

  • Has patch set
  • Resolution fixed deleted
  • Status changed from closed to 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 Changed 20 months ago by timo

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top