Opened 7 years ago

Last modified 2 years ago

#11557 new New feature

get_latest_by should support multiple columns via tuple like ordering

Reported by: Forest Bond Owned by: nobody
Component: Database layer (models, ORM) Version: 1.0
Severity: Normal Keywords: get_latest_by ordering
Cc: Forest Bond, denilsonsa@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

The ordering attribute of the Meta class is a tuple so that the default ordering can use multiple columns. It would be nice if get_latest_by was the same way. However, it currently must be a string specifying a single column.

This is especially important when specifying both, since you would typically want the latest item to correspond with the last item in a list ordered according to ordering.

Attachments (2)

django-get-latest-by-tuple.diff (1.9 KB) - added by Forest Bond 7 years ago.
Patch implementing requested feature.
django-11557.patch (6.7 KB) - added by Forest Bond 6 years ago.
Improved patch with documentation.

Download all attachments as: .zip

Change History (11)

Changed 7 years ago by Forest Bond

Patch implementing requested feature.

comment:1 Changed 7 years ago by Forest Bond

Component: UncategorizedDatabase layer (models, ORM)
Has patch: set
Keywords: get_latest_by ordering added

comment:2 Changed 7 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

comment:3 Changed 7 years ago by Forest Bond

Cc: Forest Bond added

Is my patch acceptable? It'd be great to see this in 1.3.

comment:4 Changed 6 years ago by Forest Bond

Attaching an improved patch with documentation.

Changed 6 years ago by Forest Bond

Attachment: django-11557.patch added

Improved patch with documentation.

comment:5 Changed 6 years ago by Julien Phalip

Severity: Normal
Type: New feature

comment:6 Changed 6 years ago by dmclain

Easy pickings: unset
Patch needs improvement: set
Triage Stage: AcceptedDesign decision needed

The patch no longer applies cleanly

comment:7 Changed 6 years ago by dmclain

Triage Stage: Design decision neededAccepted

Didn't mean to sent to DDN, changing back to Accepted.

comment:8 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:9 Changed 2 years ago by Denilson Figueiredo de Sá

Cc: denilsonsa@… added
Note: See TracTickets for help on using tickets.
Back to Top