Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#13455 closed Uncategorized (fixed)

QuerySet Values() interaction with Extra(select={}) not documented

Reported by: Joshua Russo Owned by: Joshua Russo
Component: Documentation Version: master
Severity: Normal Keywords: queryset extra select values values_list
Cc: 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

The behavior of Values() method being applied to the Extra(select={}) columns is not obvious or documented. This is confusing since it is not applied to the Aggregate() or Annotate() columns.

I am submitting a small update to the docs to indicate that Extra(select) must be placed before the call to Values() and the extra fields must also be within the list of Values() fields.

Personally I think that it would be better to have the Extra(select={}) either behave like the Aggregate() or Annotate() methods, or even be allowed to take precedence over the actual table columns (since they are being described explicitly). I opted against submitting a patch to accomplish this when I saw that the existing tests where written with the full awareness of the current behavior, and thus a decision must have been made by someone more important than I that this is the way it should work.

Attachments (1)

queryset_extra_w_values_doc.diff (714 bytes) - added by Joshua Russo 7 years ago.
Added a note about the interaction between Extra(select=...) and Values()/Values_list()

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by Joshua Russo

Added a note about the interaction between Extra(select=...) and Values()/Values_list()

comment:1 Changed 7 years ago by Joshua Russo

milestone: 1.31.2

Can this be in the 1.2 milestone?

comment:2 Changed 7 years ago by anonymous

Component: UncategorizedDocumentation

comment:3 Changed 7 years ago by Joshua Russo

Owner: changed from nobody to Joshua Russo
Status: newassigned

comment:4 Changed 7 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

comment:5 Changed 7 years ago by Russell Keith-Magee

Triage Stage: AcceptedReady for checkin

comment:6 Changed 7 years ago by Russell Keith-Magee

Resolution: fixed
Status: assignedclosed

(In [13145]) Fixed #13455 -- Clarified the interaction of values() and extra(). Thanks to Rupe for the report and draft text.

comment:7 Changed 7 years ago by Russell Keith-Magee

(In [13151]) [1.1.X] Fixed #13455 -- Clarified the interaction of values() and extra(). Thanks to Rupe for the report and draft text.

Backport of r13145 from trunk.

comment:8 Changed 6 years ago by Malcolm Tredinnick

In [16697]:

Corrected explanation of values() and extra() interaction in querysets.

Fixes #15546, refs #13455. The original documentation patch
inadvertently muddied the waters in one aspect and this commit tidies
that up.

comment:9 Changed 6 years ago by Joshua Russo

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

There's a small typo in mtredinnick's correction, but I don't think I can adjust a changeset.

I believe the last sentance should be "...call will have its..." instead of "...call with have its..."

comment:10 Changed 6 years ago by Aymeric Augustin

I've created a new ticket, #16712, in case Malcolm doesn't see this comment.

comment:11 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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