Generates a QuerySet with the filter applied that returns the last record. :params orderings: Fields to order by.
(cls, *orderings: str)
| 1511 | |
| 1512 | @classmethod |
| 1513 | def latest(cls, *orderings: str) -> QuerySetSingle[Self | None]: |
| 1514 | """ |
| 1515 | Generates a QuerySet with the filter applied that returns the last record. |
| 1516 | |
| 1517 | :params orderings: Fields to order by. |
| 1518 | """ |
| 1519 | return cls._meta.manager.get_queryset().latest(*orderings) |
| 1520 | |
| 1521 | @classmethod |
| 1522 | def earliest(cls, *orderings: str) -> QuerySetSingle[Self | None]: |