Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#14270 closed Cleanup/optimization (fixed)

ManyToMany manager classes should be cached

Reported by: Alex Gaynor Owned by: nobody
Component: Database layer (models, ORM) Version: 1.2
Severity: Normal Keywords:
Cc: real.human@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Right now they are created every time an m2m relationship is accessed, this class should be cached.

Attachments (3)

django-m2m-cleanup.diff (11.3 KB) - added by Carl Meyer 6 years ago.
patch from Alex Gaynor
14270-m2m-cleanup-r16522.diff (9.9 KB) - added by Tai Lee 5 years ago.
Updated to apply cleanly on r16522.
14270_r16914.diff (10.4 KB) - added by Luke Plant 5 years ago.
Updated for r16914, plus more tests

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

Changed 6 years ago by Carl Meyer

Attachment: django-m2m-cleanup.diff added

patch from Alex Gaynor

comment:2 Changed 6 years ago by Julien Phalip

Severity: Normal
Type: Cleanup/optimization

comment:3 Changed 5 years ago by Tai Lee

Cc: real.human@… added
Easy pickings: unset
UI/UX: unset

Changed 5 years ago by Tai Lee

Updated to apply cleanly on r16522.

comment:4 Changed 5 years ago by Tai Lee

This change has the added benefit of exposing the related instance on the related objects manager for reverse relationships, which makes it possible to implement a userland update_or_create(), for example, and other methods that might need access to the related instance to work correctly or efficiently.

Thanks.

Changed 5 years ago by Luke Plant

Attachment: 14270_r16914.diff added

Updated for r16914, plus more tests

comment:5 Changed 5 years ago by Luke Plant

Resolution: fixed
Status: newclosed

In [16916]:

Fixed #14270 - related manager classes should be cached

Thanks to Alex Gaynor for the report and initial patch, and mrmachine for
more work on it.

Note: See TracTickets for help on using tickets.
Back to Top