1
0
mirror of https://github.com/django/django.git synced 2025-03-12 18:30:48 +00:00

Fixed #36159 -- Removed the empty import example in the custom shell docs.

This can be achieved with the --no-imports flag.
This commit is contained in:
Salvo Polizzi 2025-01-30 10:47:11 +01:00 committed by Sarah Boyce
parent 5a2c1bc07d
commit b84478ae95

View File

@ -42,16 +42,3 @@ The above customization adds :func:`~django.urls.resolve` and
:func:`~django.urls.reverse` to the default namespace, which includes all :func:`~django.urls.reverse` to the default namespace, which includes all
models from all apps. These two functions will then be available when the models from all apps. These two functions will then be available when the
shell opens, without a manual import statement. shell opens, without a manual import statement.
If you prefer to not have models automatically imported, create a custom
``get_namespace()`` that excludes the ``super().get_namespace()`` call:
.. code-block:: python
:caption: ``polls/management/commands/shell.py``
from django.core.management.commands import shell
class Command(shell.Command):
def get_namespace(self):
return {}