Opened 13 days ago

Closed 10 days ago

Last modified 10 days ago

#35392 closed Bug (fixed)

aprefetch_related_objects cannot be imported from django.db.models

Reported by: James Ostrander Owned by: James Ostrander
Component: Database layer (models, ORM) Version: 5.0
Severity: Release blocker Keywords: prefetch, async, orm
Cc: James Ostrander 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

aprefetch_related_objects cannot be imported from django.db.models like prefetch_related_objects can. Because the docs (https://docs.djangoproject.com/en/5.0/ref/models/querysets/#prefetch-related-objects) say nothing about importing the async version from a different place, I believe this to be an oversight.

You can work around this by importing from django.db.models.query but if that's the intended behavior, the documentation should be updated to reflect that. Let me know and I'll do so happily! Otherwise, see my attached patch for a fix to the import.

Change History (6)

comment:2 by Mariusz Felisiak, 13 days ago

Needs documentation: set
Owner: changed from nobody to James Ostrander
Severity: NormalRelease blocker
Status: newassigned
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

Good catch. It's a bug in fff14736f1cc594f79ea0e2656b8375d837b7aca. Please add a release note to the 5.0.5.txt.

in reply to:  2 comment:3 by James Ostrander, 13 days ago

Replying to Mariusz Felisiak:

Please add a release note to the 5.0.5.txt.

Done!

comment:4 by Tim Graham, 12 days ago

Needs documentation: unset
Triage Stage: AcceptedReady for checkin

comment:5 by nessita <124304+nessita@…>, 10 days ago

Resolution: fixed
Status: assignedclosed

In 36b7024:

Fixed #35392, Refs #34331 -- Allowed importing aprefetch_related_objects from django.db.models.

Thanks James Ostrander for the report and fix, and to Tim Graham and
Mariusz Felisiak for the reviews.

comment:6 by Natalia <124304+nessita@…>, 10 days ago

In ea81c9d:

[5.0.x] Fixed #35392, Refs #34331 -- Allowed importing aprefetch_related_objects from django.db.models.

Thanks James Ostrander for the report and fix, and to Tim Graham and
Mariusz Felisiak for the reviews.

Backport of 36b7024b7fc881b319a2b67876e4f72ba680d6a8 from main

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