summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2026-04-19 16:36:42 +0300
committerJacob Walls <jacobtylerwalls@gmail.com>2026-04-19 22:28:13 +0300
commit5cf9c7fde7cf18c1ab4d529d187f45fb0225bb58 (patch)
treeb18a33052bf7504d5391d44facc20c0bbeab9070
parent673fa46d8063577c92cfab3a73a28e9406372e33 (diff)
Refs #28586 -- Added DEFAULT_FETCH_MODE module constant.
This is a more attractive target for alteration than all of QuerySet.__init__().
-rw-r--r--django/db/models/query.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 43b55a76d0..8eed5bf2d4 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -46,6 +46,8 @@ MAX_GET_RESULTS = 21
# The maximum number of items to display in a QuerySet.__repr__
REPR_OUTPUT_SIZE = 20
+DEFAULT_FETCH_MODE = FETCH_ONE
+
class BaseIterable:
def __init__(
@@ -335,7 +337,7 @@ class QuerySet(AltersData):
self._prefetch_done = False
self._known_related_objects = {} # {rel_field: {pk: rel_obj}}
self._iterable_class = ModelIterable
- self._fetch_mode = FETCH_ONE
+ self._fetch_mode = DEFAULT_FETCH_MODE
self._fields = None
self._defer_next_filter = False
self._deferred_filter = None
@@ -2356,7 +2358,7 @@ class RawQuerySet:
translations=None,
using=None,
hints=None,
- fetch_mode=FETCH_ONE,
+ fetch_mode=DEFAULT_FETCH_MODE,
):
self.raw_query = raw_query
self.model = model