Opened 14 years ago

Closed 13 years ago

Last modified 13 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 14 years ago.
patch from Alex Gaynor
14270-m2m-cleanup-r16522.diff (9.9 KB ) - added by Tai Lee 13 years ago.
Updated to apply cleanly on r16522.
14270_r16914.diff (10.4 KB ) - added by Luke Plant 13 years ago.
Updated for r16914, plus more tests

Download all attachments as: .zip

Change History (8)

comment:1 by Alex Gaynor, 14 years ago

Triage Stage: UnreviewedAccepted

by Carl Meyer, 14 years ago

Attachment: django-m2m-cleanup.diff added

patch from Alex Gaynor

comment:2 by Julien Phalip, 13 years ago

Severity: Normal
Type: Cleanup/optimization

comment:3 by Tai Lee, 13 years ago

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

by Tai Lee, 13 years ago

Updated to apply cleanly on r16522.

comment:4 by Tai Lee, 13 years ago

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.

by Luke Plant, 13 years ago

Attachment: 14270_r16914.diff added

Updated for r16914, plus more tests

comment:5 by Luke Plant, 13 years ago

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