#28722 closed Bug (fixed)
QuerySet.reverse() doesn't reverse nulls_first/nulls_last
| Reported by: | Tomer Chachamu | Owned by: | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.11 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The documentation for Expression.reverse_ordering says it is its own inverse:
Returns self with any modifications required to reverse the sort order within an order_by call. As an example, an expression implementing NULLS LAST would change its value to be NULLS FIRST. Modifications are only required for expressions that implement sort order like OrderBy. This method is called when reverse() is called on a queryset.
However, this isn't implemented.
https://github.com/django/django/blob/2b5a511bd9fbd67cedf72b8d39b9522c0140d023/django/db/models/expressions.py#L1133
Change History (8)
comment:1 by , 8 years ago
| Has patch: | set |
|---|
comment:2 by , 8 years ago
| Owner: | removed |
|---|---|
| Status: | assigned → new |
comment:3 by , 8 years ago
| Patch needs improvement: | set |
|---|---|
| Summary: | reverse_ordering does not reverse nulls_first/nulls_last → QuerySet.reverse() doesn't reverse nulls_first/nulls_last |
| Triage Stage: | Unreviewed → Accepted |
comment:4 by , 8 years ago
| Patch needs improvement: | unset |
|---|---|
| Triage Stage: | Accepted → Unreviewed |
comment:5 by , 8 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:6 by , 8 years ago
| Owner: | set to |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
In 21a3a29d: