Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#18875 closed Cleanup/optimization (fixed)

Document that models.Options.get_latest_by supports integers

Reported by: adamnelson Owned by: dloewenherz
Component: Documentation Version: 1.4
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


In the documentation ( , models.Options.get_latest_by specifies that DateField and DateTimeField are the only types supported for get_latest_by. In fact, any orderable field type is supported ( The documentation should simply replace "The name of a DateField or DateTimeField in the model." with "The name of a field in the model - typically a DateField, DateTimeField, or IntegerField."

Using get_latest_by('id') is very useful for large tables where reverse sorting by 'id' is a proxy for latest.

Change History (3)

comment:1 Changed 4 years ago by dloewenherz

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to dloewenherz
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by Dan Loewenherz <dloewenherz@…>

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

In [09e3d364b922510f4c14a4d843e59c37304fa1a7]:

specify any orderable field can be specified in get_latest_by, closes #18875

comment:3 Changed 4 years ago by Alex Gaynor <alex.gaynor@…>

In [cceff73acd7d82904a4b9c28dea2448f09c941b0]:

Merge pull request #335 from dlo/tickets/18875

specify any orderable field can be specified in get_latest_by, closes #18875

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