From 97b9de75328ca7ccc0632c861fbe7d4533715923 Mon Sep 17 00:00:00 2001 From: SaJH Date: Mon, 13 May 2024 01:55:16 +0900 Subject: [PATCH 1/4] 5.0: Update django.db.models.field.Field --- django-stubs/db/models/fields/__init__.pyi | 1 + scripts/stubtest/allowlist_todo_django50.txt | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index effe1e133..2bf39aba0 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -120,6 +120,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): remote_field: ForeignObjectRel | None is_relation: bool related_model: type[Model] | Literal["self"] | None + generated: bool one_to_many: bool | None one_to_one: bool | None many_to_many: bool | None diff --git a/scripts/stubtest/allowlist_todo_django50.txt b/scripts/stubtest/allowlist_todo_django50.txt index 32ebe046e..31ffaf9ed 100644 --- a/scripts/stubtest/allowlist_todo_django50.txt +++ b/scripts/stubtest/allowlist_todo_django50.txt @@ -6,7 +6,6 @@ django.contrib.gis.db.models.Case.allowed_default django.contrib.gis.db.models.ExpressionWrapper.allowed_default django.contrib.gis.db.models.F.allowed_default django.contrib.gis.db.models.Field._get_flatchoices -django.contrib.gis.db.models.Field.generated django.contrib.gis.db.models.FilteredRelation.relabeled_clone django.contrib.gis.db.models.FilteredRelation.resolve_expression django.contrib.gis.db.models.ForeignKey.cast_db_type @@ -38,7 +37,6 @@ django.db.models.Case.allowed_default django.db.models.ExpressionWrapper.allowed_default django.db.models.F.allowed_default django.db.models.Field._get_flatchoices -django.db.models.Field.generated django.db.models.FilteredRelation.relabeled_clone django.db.models.FilteredRelation.resolve_expression django.db.models.ForeignKey.cast_db_type @@ -57,7 +55,6 @@ django.db.models.expressions.F.allowed_default django.db.models.expressions.Func.allowed_default django.db.models.expressions.When.allowed_default django.db.models.fields.Field._get_flatchoices -django.db.models.fields.Field.generated django.db.models.fields.related.ForeignKey.cast_db_type django.db.models.fields.related.ForeignObject.get_joining_fields django.db.models.fields.related.ForeignObject.get_reverse_joining_fields From 505d57f5c07f34fa762f8e3b673fdba4eb80205b Mon Sep 17 00:00:00 2001 From: Jae Hyuck Sa Date: Mon, 13 May 2024 20:33:16 +0900 Subject: [PATCH 2/4] Update django.db.models.fields.__init__.pyi Co-authored-by: Nikita Sobolev --- django-stubs/db/models/fields/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index 2bf39aba0..39b1a2a07 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -120,7 +120,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): remote_field: ForeignObjectRel | None is_relation: bool related_model: type[Model] | Literal["self"] | None - generated: bool + generated: ClassVar[bool] one_to_many: bool | None one_to_one: bool | None many_to_many: bool | None From bd913511e410d37e718f947a77b5e324cd599f59 Mon Sep 17 00:00:00 2001 From: SaJH Date: Mon, 13 May 2024 22:13:42 +0900 Subject: [PATCH 3/4] Remove parameter that exist in the parent class --- django-stubs/db/models/fields/generated.pyi | 1 - 1 file changed, 1 deletion(-) diff --git a/django-stubs/db/models/fields/generated.pyi b/django-stubs/db/models/fields/generated.pyi index d3402fea7..658d971da 100644 --- a/django-stubs/db/models/fields/generated.pyi +++ b/django-stubs/db/models/fields/generated.pyi @@ -11,7 +11,6 @@ from django.utils.datastructures import DictWrapper from django.utils.functional import _StrOrPromise class GeneratedField(models.Field): - generated: Literal[True] db_returning: Literal[True] _query: Query | None output_field: models.Field | None From ab0f17f7f7bc6d8cb620815aca3fc18a9a678540 Mon Sep 17 00:00:00 2001 From: SaJH Date: Tue, 14 May 2024 00:32:57 +0900 Subject: [PATCH 4/4] 5.0: Update django.models.fields.generated --- django-stubs/db/models/fields/generated.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django-stubs/db/models/fields/generated.pyi b/django-stubs/db/models/fields/generated.pyi index 658d971da..a9257017e 100644 --- a/django-stubs/db/models/fields/generated.pyi +++ b/django-stubs/db/models/fields/generated.pyi @@ -1,4 +1,4 @@ -from typing import Any, Iterable, Literal +from typing import Any, ClassVar, Iterable, Literal from django.core.validators import _ValidatorCallable from django.db import models @@ -11,6 +11,7 @@ from django.utils.datastructures import DictWrapper from django.utils.functional import _StrOrPromise class GeneratedField(models.Field): + generated: ClassVar[Literal[True]] db_returning: Literal[True] _query: Query | None output_field: models.Field | None