#34330 closed Bug (duplicate)

QuerySet of a model having Meta.ordering, returns the sortable field in values_list() and values()

Reported by: r_valeev Owned by: nobody
Component: Database layer (models, ORM) Version: 2.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If you pass a Queryset to Subquery(), whose model has Meta.ordering, then the fields declared in ordering will be added to the result of values() or values_list() imperceptibly, then the error "Subquery returns more than 1 row" is raised

Change History (2)

comment:1 by r_valeev, 20 months ago

Component: UncategorizedDatabase layer (models, ORM)

comment:2 by Mariusz Felisiak, 20 months ago

Resolution: duplicate
Status: newclosed

As far as I'm aware it's a duplicate of #14357, fixed in Django 3.1+.

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