db.models.Options.get_latest_by

Options.get_latest_by

The name of an orderable field in the model, typically a DateField, DateTimeField, or IntegerField. This specifies the default field to use in your model Manager’s latest() and earliest() methods.

Example:

1
get_latest_by = "order_date"

See the latest() docs for more.

doc_Django
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.