Opened 11 months ago

Closed 9 months ago

#23396 closed Bug (fixed)

Regression in #14334 causes ValueError to be thrown on ValuesQuerySets

Reported by: gabejackson Owned by: gabejackson
Component: Database layer (models, ORM) Version: master
Severity: Release blocker Keywords:
Cc: timgraham, gabejackson 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 11 months ago by timgraham

  • Cc timgraham added
  • Component changed from Uncategorized to Database layer (models, ORM)
  • Easy pickings unset
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Severity changed from Normal to Release blocker
  • Triage Stage changed from Unreviewed to Accepted

(Affects master only)

comment:2 Changed 11 months ago by gabejackson

  • Cc timgraham removed
  • Component changed from Database layer (models, ORM) to Uncategorized
  • Easy pickings set
  • Has patch set
  • Severity changed from Release blocker to Normal
  • Triage Stage changed from Accepted to Unreviewed

comment:3 Changed 11 months ago by gabejackson

  • Cc timgraham gabejackson added

comment:4 Changed 11 months ago by gabejackson

  • Component changed from Uncategorized to Database layer (models, ORM)
  • Severity changed from Normal to Release blocker
  • Triage Stage changed from Unreviewed to Accepted

comment:5 Changed 11 months ago by timgraham

  • Easy pickings unset
  • Triage Stage changed from Accepted to Ready for checkin

Left some cosmetic comments, otherwise LGTM.

comment:6 Changed 11 months ago by gabejackson

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

comment:7 Changed 11 months ago by gabejackson

comment:8 Changed 9 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 0e16c3e3cd61b119e067b369f3ff928a2e4045b4:

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

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