#35547 closed Cleanup/optimization (fixed)
reset_queries not included in __all__ of django/db/__init__.py
Reported by: | AjmalPonneth | Owned by: | AjmalPonneth |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 5.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
Currently, the reset_queries method cannot be imported via from django.db import *
.
Change History (11)
comment:1 by , 4 months ago
comment:2 by , 4 months ago
Triage Stage: | Unreviewed → Accepted |
---|
Thank you, this is documented and so we should be able to import 👍
comment:3 by , 4 months ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
comment:4 by , 4 months ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
follow-up: 8 comment:5 by , 4 months ago
I think the summary is slightly misleading. It can be imported with from django.db import reset_queries
but not with from django.db import *
, right?
follow-up: 7 comment:6 by , 4 months ago
Currently, the reset_queries
function is not importable from django.db
. Since it's not included in the __all__
from django.db
.
follow-up: 9 comment:7 by , 4 months ago
Replying to AjmalPonneth:
Currently, the
reset_queries
function is not importable fromdjango.db
. Since it's not included in the__all__
fromdjango.db
.
That's not true. reset_queries
can be imported from django.db
even without including it in __all__
, e.g. https://github.com/django/django/blob/7ba2a0db20c37a5b1500434ca4ed48022311c171/django/test/utils.py#L25.
comment:8 by , 4 months ago
Description: | modified (diff) |
---|---|
Summary: | reset_queries cannot be imported from django.db → reset_queries not included in __all__ of django/db/__init__.py |
Replying to Tim Graham:
I think the summary is slightly misleading. It can be imported with
from django.db import reset_queries
but not withfrom django.db import *
, right?
Yes, it's misleading 👍
comment:9 by , 4 months ago
Replying to Mariusz Felisiak:
Replying to AjmalPonneth:
Currently, the
reset_queries
function is not importable fromdjango.db
. Since it's not included in the__all__
fromdjango.db
.
That's not true.
reset_queries
can be imported fromdjango.db
even without including it in__all__
, e.g. https://github.com/django/django/blob/7ba2a0db20c37a5b1500434ca4ed48022311c171/django/test/utils.py#L25.
I agree. But the linters will complain like this reset_queries not declared in __all__
PR: https://github.com/django/django/pull/18292