MCPcopy
hub / github.com/django/django / _get_queryset

Function _get_queryset

django/shortcuts.py:66–76  ·  view source on GitHub ↗

Return a QuerySet or a Manager. Duck typing in action: any class with a `get()` method (for get_object_or_404) or a `filter()` method (for get_list_or_404) might do the job.

(klass)

Source from the content-addressed store, hash-verified

64
65
66def _get_queryset(klass):
67 """
68 Return a QuerySet or a Manager.
69 Duck typing in action: any class with a `get()` method (for
70 get_object_or_404) or a `filter()` method (for get_list_or_404) might do
71 the job.
72 """
73 # If it is a model class or anything else with ._default_manager
74 if hasattr(klass, "_default_manager"):
75 return klass._default_manager.all()
76 return klass
77
78
79def get_object_or_404(klass, *args, **kwargs):

Callers 4

get_object_or_404Function · 0.85
aget_object_or_404Function · 0.85
get_list_or_404Function · 0.85
aget_list_or_404Function · 0.85

Calls 1

allMethod · 0.45

Tested by

no test coverage detected