get_list_or_404
Use filter() to return a list of objects, or raise an Http404 exception if the list is empty.
klass may be a Model, Manager, or QuerySet object. All other passed arguments and keyword arguments are used in the filter() query.
def get_list_or_404(
klass: Model, Manager, or QuerySet,
*args: any,
**kwargs: any
) - > list
Use filter() to return a list of objects, or raise an Http404 exception if the list is empty.
Parameters
| Name | Type | Description |
|---|---|---|
| klass | Model, Manager, or QuerySet | The Model class, Manager, or QuerySet instance from which to retrieve the objects. |
| *args | any | Positional arguments passed directly to the filter() method to define query constraints. |
| **kwargs | any | Keyword arguments passed directly to the filter() method to define query constraints. |
Returns
| Type | Description |
|---|---|
list | A list of model instances matching the provided query criteria. |