

def get_latest_objects(model, num, field='?'):
    "\n    Retrieves the latest ``num`` objects from a given model, in that\n    model's default ordering, and stores them in a context variable.\n    The optional field argument specifies which field to get_latest_by, otherwise the model's default is used\n    \n    Syntax::\n    \n        {% get_latest_objects [app_name].[model_name] [num] [field] as [varname] %}\n    \n    Example::\n    \n        {% get_latest_objects comments.freecomment 5 submitted_date as latest_comments %}\n    \n    "
    model = _get_model(model)
    if (field == '?'):
        field = ((model._meta.get_latest_by and ('-%s' % model._meta.get_latest_by)) or field)
    return model._default_manager.order_by(field)[:int(num)]

dataset/ETHPy150Open justquick/django-native-tags/native_tags/contrib/generic_content.py get_latest_objects/original