def get_object_from_list_detail_view(request, *args, **kwargs):
    queryset = kwargs['queryset']
    object_id = kwargs.get('object_id', None)
    slug = kwargs.get('slug', None)
    slug_field = kwargs.get('slug_field', 'slug')
    if object_id:
        obj = get_object_or_404(queryset, pk=object_id)
    elif slug and slug_field:
        obj = get_object_or_404(queryset, **{slug_field: slug})
    else:
        raise AttributeError(
                "Generic detail view must be called with either an "
                "object_id or a slug/slug_field."
            )
    return obj
Main entry point for script.
dataset/ETHPy150Open lambdalisue/django-permission/src/permission/decorators/functionbase.py/get_object_from_list_detail_view--crossover with--dataset/ETHPy150Open cloudify-cosmo/packman/packman/pkm.py/pkm