Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#26526 closed Cleanup/optimization (fixed)

Document QuerySet.latest() behavior for null values

Reported by: Serhiy Owned by: Chad Shrock
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

When sorting by date null values mean that date is unknown. Is there a reason to put them before any known date? Absence of date doesn't necessary mean an event will happen in the future, it means that the date is unknown. And word 'latest' suggests sorting by a known date.

Change History (14)

comment:1 by Tim Graham, 9 years ago

Component: UncategorizedDocumentation
Summary: latest() QuerySet method should ignore null valuesDocument QuerySet.latest() behavior for null values

Django simply delegates to the database's ordering of null values. I'm not sure if Django should also add filtering to exclude null values -- that seems a bit magical to me. However, you could raise the idea on the DevelopersMailingList. For now, I'll accept the ticket as a documentation improvement.

comment:2 by Serhiy, 9 years ago

Thank you, I've found related ticket about ordering NULL: #13312

comment:3 by Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Alberto Julio Leal Rivera, 9 years ago

hi, If there is no problem I would like to claim this ticket.

comment:5 by Tim Graham, 9 years ago

Sure, no need to ask unless it looks like someone else might be working on it. See our docs for Claiming tickets.

comment:6 by Parv Jain, 9 years ago

Owner: changed from nobody to Parv Jain
Status: newassigned

comment:7 by Serhiy, 9 years ago

N.B.: according to #13312 different DBMS behave differently.

comment:8 by Carl Meyer, 9 years ago

Owner: Parv Jain removed
Status: assignednew

Since there hasn't been apparent progress in the 5 weeks since the ticket was claimed, de-assigning it to free it up for a PyCon sprinter.

comment:9 by Chad Shrock, 9 years ago

Owner: set to Chad Shrock
Status: newassigned

comment:11 by Chad Shrock, 9 years ago

Has patch: set

comment:12 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In e6c5e68a:

Fixed #26526 -- Documented QuerySet.latest()'s dependency on database ordering.

comment:13 by Tim Graham <timograham@…>, 9 years ago

In cd4246aa:

[1.10.x] Fixed #26526 -- Documented QuerySet.latest()'s dependency on database ordering.

Backport of e6c5e68acd4bff90e371fd148ed6976e147692ad from master

comment:14 by Tim Graham <timograham@…>, 9 years ago

In 9d52cdfb:

[1.9.x] Fixed #26526 -- Documented QuerySet.latest()'s dependency on database ordering.

Backport of e6c5e68acd4bff90e371fd148ed6976e147692ad from master

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