Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#13455 closed Uncategorized (fixed)

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

Reported by: Rupe Owned by: Rupe
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 Rupe 5 years ago.
Added a note about the interaction between Extra(select=...) and Values()/Values_list()

Download all attachments as: .zip

Change History (12)

Changed 5 years ago by Rupe

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

comment:1 Changed 5 years ago by Rupe

  • milestone changed from 1.3 to 1.2
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Can this be in the 1.2 milestone?

comment:2 Changed 5 years ago by anonymous

  • Component changed from Uncategorized to Documentation

comment:3 Changed 5 years ago by Rupe

  • Owner changed from nobody to Rupe
  • Status changed from new to assigned

comment:4 Changed 5 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

comment:5 Changed 5 years ago by russellm

  • Triage Stage changed from Accepted to Ready for checkin

comment:6 Changed 5 years ago by russellm

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

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

comment:7 Changed 5 years ago by russellm

(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 4 years ago by mtredinnick

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 4 years ago by Rupe

  • Easy pickings unset
  • Severity set to Normal
  • Type set to 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 4 years ago by aaugustin

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

comment:11 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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