Opened 9 years ago

Last modified 9 years ago

#25279 closed New feature

Make prefetch_related_objects a public API — at Initial Version

Reported by: Adam Johnson Owned by: nobody
Component: Database layer (models, ORM) Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

prefetch_related is great, but it would be nice to be able to reuse its capabilities with lists of model instances already retrieved by other code (or from cache, or newly constructed, etc.). It seems this is possible by using django.db.models.query.prefetch_related_objects which is the function implementing all the prefetch capability - I've just seen it used fine, however it is not part of Django's public API.

As far as I can tell, just doing an import in django.db.models.__init__ and adding documentation should be enough to make it public, since prefetch_related_objects contains all the functionality that prefetch_related exposes.

Change History (0)

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