'Returns the latest object, according to the model\'s
\'get_latest_by\' option or optional given field_name.'

def _earliest_or_latest(self, field_name=None, direction='-'):

    order_by = (field_name or getattr(self.model._meta, 'get_latest_by'))
    assert bool(order_by), "earliest()    and    latest()    require    either    a    field_name    parameter    or    'get_latest_by'    in    the    model"
    assert self.query.can_filter(), 'Cannot    change    a    query    once    a    slice    has    been    taken.'
    obj = self._clone()
    obj.query.set_limits(high=1)
    obj.query.clear_ordering(force_empty=True)
    obj.query.add_ordering(('%s%s' % (direction, order_by)))
    return obj.get()
