1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #35680 -- Added automatic imports of common utilies to shell management command.

This commit is contained in:
Salvo Polizzi
2025-02-14 08:17:25 +01:00
committed by Sarah Boyce
parent 8499fba0e1
commit a5cd84ad20
5 changed files with 119 additions and 20 deletions

View File

@@ -1067,9 +1067,15 @@ Starts the Python interactive interpreter.
All models from installed apps are automatically imported into the shell
environment. Models from apps listed earlier in :setting:`INSTALLED_APPS` take
precedence. For a ``--verbosity`` of 2 or higher, the automatically imported
objects will be listed. To disable automatic importing entirely, use the
``--no-imports`` flag.
precedence. The following common utilities are also imported::
from django.db import connection, reset_queries, models
from django.conf import settings
from django.utils import timezone
For a ``--verbosity`` of 2 or higher, the automatically imported objects will
be listed. To disable automatic importing entirely, use the ``--no-imports``
flag.
See the guide on :ref:`customizing this behavior
<customizing-shell-auto-imports>` to add or remove automatic imports.
@@ -1078,6 +1084,11 @@ See the guide on :ref:`customizing this behavior
Automatic models import was added.
.. versionchanged:: 6.0
Automatic imports of common utilities, such as ``django.conf.settings``,
were added.
.. django-admin-option:: --interface {ipython,bpython,python}, -i {ipython,bpython,python}
Specifies the shell to use. By default, Django will use IPython_ or bpython_ if