summaryrefslogtreecommitdiff
path: root/docs/howto
diff options
context:
space:
mode:
authorSalvo Polizzi <salvopolizzi03@gmail.com>2025-02-14 08:17:25 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-07-17 12:51:43 +0200
commita5cd84ad2002f9a43363ab9fd9d9f6e9dfa48c60 (patch)
treee2307cc155727fe1ecd7042a215689ef1df507b5 /docs/howto
parent8499fba0e18826a77fe32cbc13a3d951d9ca8924 (diff)
Fixed #35680 -- Added automatic imports of common utilies to shell management command.
Diffstat (limited to 'docs/howto')
-rw-r--r--docs/howto/custom-shell.txt17
1 files changed, 13 insertions, 4 deletions
diff --git a/docs/howto/custom-shell.txt b/docs/howto/custom-shell.txt
index c1632849b5..cf55a02400 100644
--- a/docs/howto/custom-shell.txt
+++ b/docs/howto/custom-shell.txt
@@ -39,20 +39,29 @@ For example:
The customization above adds :func:`~django.urls.resolve` and
:func:`~django.urls.reverse` to the default namespace, which already includes
-all models from the apps listed in :setting:`INSTALLED_APPS`. These objects
-will be available in the ``shell`` without requiring a manual import.
+all models from the apps listed in :setting:`INSTALLED_APPS` plus what is
+imported by default. These objects will be available in the ``shell`` without
+requiring a manual import.
Running this customized ``shell`` command with ``verbosity=2`` would show:
.. console::
- 8 objects imported automatically:
-
+ 13 objects imported automatically:
+
+ from django.db import connection, reset_queries, models
+ from django.conf import settings
from django.contrib.admin.models import LogEntry
from django.contrib.auth.models import Group, Permission, User
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.models import Session
from django.urls import resolve, reverse
+ from django.utils import timezone
+
+.. versionchanged:: 6.0
+
+ Automatic imports of common utilities, such as ``django.conf.settings``,
+ were added.
If an overridden ``shell`` command includes paths that cannot be imported,
these errors are shown when ``verbosity`` is set to ``1`` or higher. Duplicate