It would be best to implement the latest() classmethod class directly on MyObject and call it as
latest = MyObject.latest()
Anything else would require monkeypatching the built-in Query class.
Update
I thought I would see how ugly it would be to implement this functionality. Here is the mixin class that you can use if you really want to call MyObject.all().latest() :
class LatestMixin(object): """A mixin for db.Model objects that will add a `latest` method to the `Query` object returned by cls.all(). Requires that the ORDER_FIELD contain the name of the field by which to order the query to determine the latest object."""
source share