Opened 10 years ago

Closed 10 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: dev
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 by Tim Graham, 10 years ago

Cc: Tim Graham added
Component: UncategorizedDatabase layer (models, ORM)
Easy pickings: unset
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

(Affects master only)

comment:2 by Gabe Jackson, 10 years ago

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

comment:3 by Gabe Jackson, 10 years ago

Cc: Tim Graham Gabe Jackson added

comment:4 by Gabe Jackson, 10 years ago

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

comment:5 by Tim Graham, 10 years ago

Easy pickings: unset
Triage Stage: AcceptedReady for checkin

Left some cosmetic comments, otherwise LGTM.

comment:6 by Gabe Jackson, 10 years ago

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

comment:8 by Tim Graham <timograham@…>, 10 years ago

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