Skip to content

Commit 5cf9c7f

Browse files
Refs #28586 -- Added DEFAULT_FETCH_MODE module constant.
This is a more attractive target for alteration than all of QuerySet.__init__().
1 parent 673fa46 commit 5cf9c7f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

django/db/models/query.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
# The maximum number of items to display in a QuerySet.__repr__
4747
REPR_OUTPUT_SIZE = 20
4848

49+
DEFAULT_FETCH_MODE = FETCH_ONE
50+
4951

5052
class BaseIterable:
5153
def __init__(
@@ -335,7 +337,7 @@ def __init__(self, model=None, query=None, using=None, hints=None):
335337
self._prefetch_done = False
336338
self._known_related_objects = {} # {rel_field: {pk: rel_obj}}
337339
self._iterable_class = ModelIterable
338-
self._fetch_mode = FETCH_ONE
340+
self._fetch_mode = DEFAULT_FETCH_MODE
339341
self._fields = None
340342
self._defer_next_filter = False
341343
self._deferred_filter = None
@@ -2356,7 +2358,7 @@ def __init__(
23562358
translations=None,
23572359
using=None,
23582360
hints=None,
2359-
fetch_mode=FETCH_ONE,
2361+
fetch_mode=DEFAULT_FETCH_MODE,
23602362
):
23612363
self.raw_query = raw_query
23622364
self.model = model

0 commit comments

Comments
 (0)