diff --git a/django-stubs/contrib/contenttypes/prefetch.pyi b/django-stubs/contrib/contenttypes/prefetch.pyi new file mode 100644 index 000000000..f645e8cd3 --- /dev/null +++ b/django-stubs/contrib/contenttypes/prefetch.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.db.models import Prefetch +from django.db.models.query import QuerySet + +class GenericPrefetch(Prefetch): + def __init__(self, lookup: str, querysets: list[QuerySet], to_attr: str | None = ...) -> None: ... + def __getstate__(self) -> dict[str, Any]: ... + def get_current_querysets(self, level: int) -> list[QuerySet] | None: ... diff --git a/scripts/stubtest/allowlist_todo_django50.txt b/scripts/stubtest/allowlist_todo_django50.txt index 227ed3c2c..eaf277ec3 100644 --- a/scripts/stubtest/allowlist_todo_django50.txt +++ b/scripts/stubtest/allowlist_todo_django50.txt @@ -4,7 +4,6 @@ django.contrib.contenttypes.fields.GenericForeignKey.get_content_type django.contrib.contenttypes.fields.GenericForeignKey.get_prefetch_querysets -django.contrib.contenttypes.prefetch django.contrib.gis.db.models.Case.allowed_default django.contrib.gis.db.models.ExpressionWrapper.allowed_default django.contrib.gis.db.models.F.allowed_default diff --git a/tests/typecheck/test_import_all.yml b/tests/typecheck/test_import_all.yml index f35775b39..ceadf076d 100644 --- a/tests/typecheck/test_import_all.yml +++ b/tests/typecheck/test_import_all.yml @@ -81,6 +81,7 @@ import django.contrib.contenttypes.migrations import django.contrib.contenttypes.models import django.contrib.contenttypes.views + import django.contrib.contenttypes.prefetch import django.contrib.flatpages import django.contrib.flatpages.admin import django.contrib.flatpages.apps