Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#14942 closed (invalid)

.distinct() + ordering/order_by() is a problem even without related models

Reported by: Xof Owned by: nobody
Component: Documentation Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The documentation at http://docs.djangoproject.com/en/1.2/ref/models/querysets/#distinct implies that using .distinct() with ordering (which can come from either the Meta value or the .order_by() call on the QuerySet) is only an issue if you are querying across related models, but that's not true; it can bite you even if you are staying within the same model. A rewrite of the note in question is probably in order.

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by gabrielhurley

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Can you provide an example of when/why this is can be a problem when ordering with fields on a single model?

comment:2 Changed 3 years ago by russellm

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

Closing invalid; the report asserts that the problem exists on single-model queries, but doesn't elaborate on the circumstances in which it is a problem, and it's not obvious to me (or Gabriel, obviously) what the problem case would be.

Feel free to reopen if you can provide more details (either draft replacement text, or a simple example of a problem case)

comment:3 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.