#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 Raffaella):
Replying to [comment:3 Clifford Gama]:
> Thanks Raffaella for the report and for testing. However, I can't
replicate this with the provided information. For me, imports repeated in
`get_auto_imports` are displayed only once, no matter how many times they
are repeated. I tried this with verbosity of 2 and 3 and on ipython and
regular python shell.
Thanks Cliffort for your reply.
I tried it on a different project, and I do have multiple imports of the
same `reverse` when running `python manage.py shell -v=2` with this code
{{{
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",
]
}}}
When I open the shell:
{{{
9 objects imported automatically:
from page.models import Tag, Blog
from django.contrib.sessions.models import Session
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User, Group, Permission
from django.contrib.admin.models import LogEntry
from django.urls import reverse, reverse, reverse, reverse, reverse,
reverse
}}}
My current django version is `5.2b1`.
The number of the 9 imports is correct.
--
Ticket URL: <https://code.djangoproject.com/ticket/36252#comment:4>
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/010701958eeab364-6e6f47ab-d4a4-490a-9ea4-4e79436a6593-000000%40eu-central-1.amazonses.com.