Opened 2 years ago

Closed 2 years ago

#23396 closed Bug (fixed)

Regression in #14334 causes ValueError to be thrown on ValuesQuerySets

Reported by: Gabe Jackson Owned by: Gabe Jackson
Component: Database layer (models, ORM) Version: master
Severity: Release blocker Keywords:
Cc: Tim Graham, Gabe Jackson 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

check_related_objects shouldn't be called for ValuesQuerySets. This will lead to a ValueError 'Cannot use QuerySet for 'x': Use a QuerySet for 'y when doing something like:

Author.objects.filter(book__in=Author.objects.values_list('pk'))

whereas this is fine:

Author.objects.filter(book__pk__in=Author.objects.values_list('pk'))

The prior syntax used to work in django <1.8 before #14334 and #23266 were applied.

Pull request with fix and test to follow.

Change History (8)

comment:1 Changed 2 years ago by Tim Graham

Cc: Tim Graham added
Component: UncategorizedDatabase layer (models, ORM)
Easy pickings: unset
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

(Affects master only)

comment:2 Changed 2 years ago by Gabe Jackson

Cc: Tim Graham removed
Component: Database layer (models, ORM)Uncategorized
Easy pickings: set
Has patch: set
Severity: Release blockerNormal
Triage Stage: AcceptedUnreviewed

comment:3 Changed 2 years ago by Gabe Jackson

Cc: Tim Graham Gabe Jackson added

comment:4 Changed 2 years ago by Gabe Jackson

Component: UncategorizedDatabase layer (models, ORM)
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:5 Changed 2 years ago by Tim Graham

Easy pickings: unset
Triage Stage: AcceptedReady for checkin

Left some cosmetic comments, otherwise LGTM.

comment:6 Changed 2 years ago by Gabe Jackson

Thanks for the review. I cleaned it up according to your comments.

comment:7 Changed 2 years ago by Gabe Jackson

comment:8 Changed 2 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 0e16c3e3cd61b119e067b369f3ff928a2e4045b4:

Fixed #23396 -- Ensured ValueQuerySets are not checked by check_related_objects.

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