From 2d1c410cb9f7f9a403543f7b664bc0369ef31bb5 Mon Sep 17 00:00:00 2001 From: SaJH Date: Fri, 3 May 2024 10:31:26 +0900 Subject: [PATCH 1/3] 5.0: Update django.contrib.contenttypes.prefetch --- django-stubs/contrib/contenttypes/prefetch.pyi | 9 +++++++++ scripts/stubtest/allowlist_todo_django50.txt | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 django-stubs/contrib/contenttypes/prefetch.pyi diff --git a/django-stubs/contrib/contenttypes/prefetch.pyi b/django-stubs/contrib/contenttypes/prefetch.pyi new file mode 100644 index 000000000..a068dc220 --- /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] | None = ..., 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 291e577cb..4bec4f3f8 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.admin.OpenLayersWidget django.contrib.gis.admin.options.spherical_mercator_srid django.contrib.gis.admin.widgets From 976ea2633a01a21def6c3fc42d1e0af054508e32 Mon Sep 17 00:00:00 2001 From: SaJH Date: Fri, 3 May 2024 12:33:41 +0900 Subject: [PATCH 2/3] Update import test file --- tests/typecheck/test_import_all.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/typecheck/test_import_all.yml b/tests/typecheck/test_import_all.yml index 19c14a472..18adec157 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 From 0580ea5b6ddc2bbe559d9b43e612a449c531462a Mon Sep 17 00:00:00 2001 From: Jae Hyuck Sa Date: Sat, 4 May 2024 23:06:07 +0900 Subject: [PATCH 3/3] Update prefetch.pyi --- django-stubs/contrib/contenttypes/prefetch.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django-stubs/contrib/contenttypes/prefetch.pyi b/django-stubs/contrib/contenttypes/prefetch.pyi index a068dc220..f645e8cd3 100644 --- a/django-stubs/contrib/contenttypes/prefetch.pyi +++ b/django-stubs/contrib/contenttypes/prefetch.pyi @@ -4,6 +4,6 @@ from django.db.models import Prefetch from django.db.models.query import QuerySet class GenericPrefetch(Prefetch): - def __init__(self, lookup: str, querysets: list[QuerySet] | None = ..., to_attr: str | None = ...) -> None: ... + 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: ...