diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index effe1e133..39b1a2a07 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: ClassVar[bool] one_to_many: bool | None one_to_one: bool | None many_to_many: bool | None diff --git a/django-stubs/db/models/fields/generated.pyi b/django-stubs/db/models/fields/generated.pyi index d3402fea7..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,7 +11,7 @@ from django.utils.datastructures import DictWrapper from django.utils.functional import _StrOrPromise class GeneratedField(models.Field): - generated: Literal[True] + generated: ClassVar[Literal[True]] db_returning: Literal[True] _query: Query | None output_field: models.Field | None diff --git a/scripts/stubtest/allowlist_todo_django50.txt b/scripts/stubtest/allowlist_todo_django50.txt index 53e797930..d34dce68c 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 @@ -36,7 +35,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 @@ -53,7 +51,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.ForeignObjectRel.get_joining_fields django.db.models.fields.related.ForwardManyToOneDescriptor.get_prefetch_querysets