#36252: Duplicate Display of Imports in Django Shell
-------------------------------------+-------------------------------------
Reporter: Raffaella | Owner: hesham
| hatem
Type: Bug | Status: closed
Component: Core (Management | Version: 5.2
commands) | Resolution:
Severity: Normal | worksforme
Keywords: shell | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Natalia Bidart):
Thank you Raffaella and Clifford for the reporting and handling of this
ticket. I can't reproduce either, using Django `main`, with a custom shell
command like this:
{{{#!python
from django.core.management.commands import shell
class Command(shell.Command):
def get_auto_imports(self):
return super().get_auto_imports() + [
"django.urls.reverse",
"django.urls.reverse",
"django.urls.reverse",
"django.urls.reverse",
"django.urls.reverse",
"django.urls.reverse",
"django.urls.reverse",
"django.urls.reverse",
"django.urls.reverse",
]
}}}
I get (models are custom from my django test project where I do general
ticket triage):
{{{
$ python -Wall manage.py shell --verbosity=2
30 objects imported automatically:
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 reverse
from abstractmodels.models import ArticlePage, Page
from complexapp.models.a import ModelA
from complexapp.models.b import ModelB
from complexapp.models.c import ModelC
from generatedapp.models import (Author, AuthorProfile, Book, BookGenre,
Genre, Review)
from testapp.models import (BasicModel, CollidingModelName, Course,
Student,
Ticket36031Model, UUIDModel,
VulnerableModel)
from ticket_35928.models import (BlogPost, CollidingModelName, Comment,
Image, Product, TaggedItem)
Python 3.13.2 (main, Feb 5 2025, 08:49:06) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36252#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701958f885cb9-947e11d0-c5c6-48fc-a34a-283af6a5da1b-000000%40eu-central-1.amazonses.com.