From 15ef8d945f013916bf1590d5d51c1b7c56c72445 Mon Sep 17 00:00:00 2001 From: Karataev Pavel Date: Thu, 29 Aug 2024 23:33:14 +0300 Subject: [PATCH] Fixup db.models.fields.Field overloads for pyright 1.1.378 (#264) --- .../contrib/postgres/fields/array.pyi | 6 +- .../contrib/postgres/fields/citext.pyi | 18 ++- .../contrib/postgres/fields/hstore.pyi | 6 +- django-stubs/db/models/fields/__init__.pyi | 138 ++++++++++++------ django-stubs/db/models/fields/json.pyi | 6 +- django-stubs/db/models/fields/related.pyi | 18 ++- 6 files changed, 128 insertions(+), 64 deletions(-) diff --git a/django-stubs/contrib/postgres/fields/array.pyi b/django-stubs/contrib/postgres/fields/array.pyi index d2faca050..f23f74eba 100644 --- a/django-stubs/contrib/postgres/fields/array.pyi +++ b/django-stubs/contrib/postgres/fields/array.pyi @@ -22,12 +22,13 @@ class ArrayField(CheckFieldDefaultMixin, Generic[_V], Field[_V | Combinable, _V] base_field: Field[Any, _V], size: int | None = ..., verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: list[_V] | Callable[[], list[_V]] | None = ..., editable: bool = ..., @@ -51,12 +52,13 @@ class ArrayField(CheckFieldDefaultMixin, Generic[_V], Field[_V | Combinable, _V] base_field: Field[Any, _V], size: int | None = ..., verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: list[_V] | Callable[[], list[_V]] | None = ..., editable: bool = ..., diff --git a/django-stubs/contrib/postgres/fields/citext.pyi b/django-stubs/contrib/postgres/fields/citext.pyi index b85e00010..64498f979 100644 --- a/django-stubs/contrib/postgres/fields/citext.pyi +++ b/django-stubs/contrib/postgres/fields/citext.pyi @@ -20,12 +20,13 @@ class CICharField(CIText, CharField[_C]): def __init__( self: CICharField[str], verbose_name: str | bytes | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -45,12 +46,13 @@ class CICharField(CIText, CharField[_C]): def __init__( self: CICharField[str | None], verbose_name: str | bytes | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -74,12 +76,13 @@ class CIEmailField(CIText, EmailField[_C]): def __init__( self: CIEmailField[str], verbose_name: str | bytes | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -99,12 +102,13 @@ class CIEmailField(CIText, EmailField[_C]): def __init__( self: CIEmailField[str | None], verbose_name: str | bytes | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -128,12 +132,13 @@ class CITextField(CIText, TextField[_C]): def __init__( self: CITextField[str], verbose_name: str | bytes | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -153,12 +158,13 @@ class CITextField(CIText, TextField[_C]): def __init__( self: CITextField[str | None], verbose_name: str | bytes | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: Any = ..., editable: bool = ..., diff --git a/django-stubs/contrib/postgres/fields/hstore.pyi b/django-stubs/contrib/postgres/fields/hstore.pyi index cc506ca9e..c5c2fd564 100644 --- a/django-stubs/contrib/postgres/fields/hstore.pyi +++ b/django-stubs/contrib/postgres/fields/hstore.pyi @@ -19,12 +19,13 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]): def __init__( self: HStoreField[dict[str, str | None]], verbose_name: str | bytes | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -44,12 +45,13 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]): def __init__( self: HStoreField[dict[str, str | None] | None], verbose_name: str | bytes | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: Any = ..., editable: bool = ..., diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index 4cb1af1d8..1b5adb84b 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -117,12 +117,13 @@ class IntegerField(Generic[_I], Field[_I | Combinable, _I]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _I | Callable[[], _I] | None = ..., editable: bool = ..., @@ -143,12 +144,13 @@ class IntegerField(Generic[_I], Field[_I | Combinable, _I]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _I | Callable[[], _I] = ..., editable: bool = ..., @@ -174,12 +176,13 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _I | Callable[[], _I] | None = ..., editable: bool = ..., @@ -200,12 +203,13 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _I | Callable[[], _I] = ..., editable: bool = ..., @@ -228,12 +232,13 @@ class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]) def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _I | Callable[[], _I] | None = ..., editable: bool = ..., @@ -253,12 +258,13 @@ class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]) def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _I | Callable[[], _I] = ..., editable: bool = ..., @@ -281,12 +287,13 @@ class SmallIntegerField(IntegerField[_I]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _I | Callable[[], _I] | None = ..., editable: bool = ..., @@ -307,12 +314,13 @@ class SmallIntegerField(IntegerField[_I]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _I | Callable[[], _I] = ..., editable: bool = ..., @@ -335,12 +343,13 @@ class BigIntegerField(IntegerField[_I]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _I | Callable[[], _I] | None = ..., editable: bool = ..., @@ -361,12 +370,13 @@ class BigIntegerField(IntegerField[_I]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _I | Callable[[], _I] = ..., editable: bool = ..., @@ -389,12 +399,13 @@ class PositiveBigIntegerField(IntegerField[_I]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _I | Callable[[], _I] | None = ..., editable: bool = ..., @@ -415,12 +426,13 @@ class PositiveBigIntegerField(IntegerField[_I]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _I | Callable[[], _I] = ..., editable: bool = ..., @@ -445,12 +457,13 @@ class FloatField(Generic[_F], Field[_F | Combinable, _F]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _F | Callable[[], _F] | None = ..., editable: bool = ..., @@ -471,12 +484,13 @@ class FloatField(Generic[_F], Field[_F | Combinable, _F]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _F | Callable[[], _F] = ..., editable: bool = ..., @@ -504,6 +518,7 @@ class DecimalField(Generic[_DEC], Field[_DEC | Combinable, _DEC]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., max_digits: int = ..., decimal_places: int = ..., @@ -511,7 +526,7 @@ class DecimalField(Generic[_DEC], Field[_DEC | Combinable, _DEC]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _DEC | Callable[[], _DEC] | None = ..., editable: bool = ..., @@ -534,6 +549,7 @@ class DecimalField(Generic[_DEC], Field[_DEC | Combinable, _DEC]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., max_digits: int = ..., decimal_places: int = ..., @@ -541,7 +557,7 @@ class DecimalField(Generic[_DEC], Field[_DEC | Combinable, _DEC]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _DEC | Callable[[], _DEC] = ..., editable: bool = ..., @@ -664,13 +680,14 @@ class CharField(Generic[_C], Field[_C | Combinable, _C]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _C | Callable[[], _C] | None = ..., editable: bool = ..., @@ -692,13 +709,14 @@ class CharField(Generic[_C], Field[_C | Combinable, _C]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _C | Callable[[], _C] = ..., editable: bool = ..., @@ -722,13 +740,14 @@ class SlugField(CharField[_C]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _C | Callable[[], _C] | None = ..., editable: bool = ..., @@ -750,13 +769,14 @@ class SlugField(CharField[_C]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _C | Callable[[], _C] = ..., editable: bool = ..., @@ -780,13 +800,14 @@ class EmailField(CharField[_C]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _C | Callable[[], _C] | None = ..., editable: bool = ..., @@ -807,13 +828,14 @@ class EmailField(CharField[_C]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _C | Callable[[], _C] = ..., editable: bool = ..., @@ -836,13 +858,14 @@ class URLField(CharField[_C]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _C | Callable[[], _C] | None = ..., editable: bool = ..., @@ -863,13 +886,14 @@ class URLField(CharField[_C]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _C | Callable[[], _C] = ..., editable: bool = ..., @@ -892,13 +916,14 @@ class TextField(Generic[_C], Field[_C | Combinable, _C]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _C | Callable[[], _C] | None = ..., editable: bool = ..., @@ -919,13 +944,14 @@ class TextField(Generic[_C], Field[_C | Combinable, _C]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _C | Callable[[], _C] = ..., editable: bool = ..., @@ -950,13 +976,14 @@ class BooleanField(Generic[_B], Field[_B | Combinable, _B]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _B | Callable[[], _B] | None = ..., editable: bool = ..., @@ -977,13 +1004,14 @@ class BooleanField(Generic[_B], Field[_B | Combinable, _B]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., db_collation: str | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _B | Callable[[], _B] = ..., editable: bool = ..., @@ -1005,12 +1033,13 @@ class IPAddressField(Generic[_C], Field[_C | Combinable, _C]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _C | Callable[[], _C] | None = ..., editable: bool = ..., @@ -1031,12 +1060,13 @@ class IPAddressField(Generic[_C], Field[_C | Combinable, _C]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _C | Callable[[], _C] = ..., editable: bool = ..., @@ -1062,6 +1092,7 @@ class GenericIPAddressField( def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., protocol: str = ..., unpack_ipv4: bool = ..., @@ -1069,7 +1100,7 @@ class GenericIPAddressField( max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _C | Callable[[], _C] | None = ..., editable: bool = ..., @@ -1090,6 +1121,7 @@ class GenericIPAddressField( def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., protocol: str = ..., unpack_ipv4: bool = ..., @@ -1097,7 +1129,7 @@ class GenericIPAddressField( max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _C | Callable[[], _C] = ..., editable: bool = ..., @@ -1127,6 +1159,7 @@ class DateField(DateTimeCheckMixin, Field[_DD | Combinable, _DD]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., auto_now: bool = ..., auto_now_add: bool = ..., @@ -1134,7 +1167,7 @@ class DateField(DateTimeCheckMixin, Field[_DD | Combinable, _DD]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _DD | Callable[[], _DD] | None = ..., editable: bool = ..., @@ -1157,6 +1190,7 @@ class DateField(DateTimeCheckMixin, Field[_DD | Combinable, _DD]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., auto_now: bool = ..., auto_now_add: bool = ..., @@ -1164,7 +1198,7 @@ class DateField(DateTimeCheckMixin, Field[_DD | Combinable, _DD]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _DD | Callable[[], _DD] = ..., editable: bool = ..., @@ -1194,6 +1228,7 @@ class TimeField(Generic[_TM], DateTimeCheckMixin, Field[_TM | Combinable, _TM]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., auto_now: bool = ..., auto_now_add: bool = ..., @@ -1201,7 +1236,7 @@ class TimeField(Generic[_TM], DateTimeCheckMixin, Field[_TM | Combinable, _TM]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _TM | Callable[[], _TM] | None = ..., editable: bool = ..., @@ -1224,6 +1259,7 @@ class TimeField(Generic[_TM], DateTimeCheckMixin, Field[_TM | Combinable, _TM]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., auto_now: bool = ..., auto_now_add: bool = ..., @@ -1231,7 +1267,7 @@ class TimeField(Generic[_TM], DateTimeCheckMixin, Field[_TM | Combinable, _TM]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _TM | Callable[[], _TM] = ..., editable: bool = ..., @@ -1261,6 +1297,7 @@ class DateTimeField(DateField[_DT]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., auto_now: bool = ..., auto_now_add: bool = ..., @@ -1268,7 +1305,7 @@ class DateTimeField(DateField[_DT]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _DT | Callable[[], _DT] | None = ..., editable: bool = ..., @@ -1291,6 +1328,7 @@ class DateTimeField(DateField[_DT]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., auto_now: bool = ..., auto_now_add: bool = ..., @@ -1298,7 +1336,7 @@ class DateTimeField(DateField[_DT]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _DT | Callable[[], _DT] = ..., editable: bool = ..., @@ -1325,12 +1363,13 @@ class UUIDField(Generic[_U], Field[str | _U, _U]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _U | Callable[[], _U] | None = ..., editable: bool = ..., @@ -1351,12 +1390,13 @@ class UUIDField(Generic[_U], Field[str | _U, _U]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _U | Callable[[], _U] = ..., editable: bool = ..., @@ -1384,6 +1424,7 @@ class FilePathField(Generic[_C], Field[_C, _C]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., path: str | Callable[..., str] = ..., match: str | None = ..., @@ -1394,7 +1435,7 @@ class FilePathField(Generic[_C], Field[_C, _C]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _C | Callable[[], _C] | None = ..., editable: bool = ..., @@ -1415,6 +1456,7 @@ class FilePathField(Generic[_C], Field[_C, _C]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., path: str | Callable[..., str] = ..., match: str | None = ..., @@ -1425,7 +1467,7 @@ class FilePathField(Generic[_C], Field[_C, _C]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _C | Callable[[], _C] = ..., editable: bool = ..., @@ -1450,12 +1492,13 @@ class BinaryField(Generic[_BIN], Field[_BIN | bytearray | memoryview, _BIN]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _BIN | Callable[[], _BIN] | None = ..., editable: bool = ..., @@ -1478,12 +1521,13 @@ class BinaryField(Generic[_BIN], Field[_BIN | bytearray | memoryview, _BIN]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _BIN | Callable[[], _BIN] = ..., editable: bool = ..., @@ -1510,12 +1554,13 @@ class DurationField(Generic[_TD], Field[_TD, _TD]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _TD | Callable[[], _TD] | None = ..., editable: bool = ..., @@ -1538,12 +1583,13 @@ class DurationField(Generic[_TD], Field[_TD, _TD]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., primary_key: bool = ..., max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _TD | Callable[[], _TD] = ..., editable: bool = ..., diff --git a/django-stubs/db/models/fields/json.pyi b/django-stubs/db/models/fields/json.pyi index b2a078962..2ef86ad09 100644 --- a/django-stubs/db/models/fields/json.pyi +++ b/django-stubs/db/models/fields/json.pyi @@ -23,6 +23,7 @@ class JSONField(CheckFieldDefaultMixin, Field[_A | Combinable, _A]): def __new__( # type: ignore [misc] cls, verbose_name: str | None = ..., + *, name: str | None = ..., encoder: type[json.JSONEncoder] = ..., decoder: type[json.JSONDecoder] = ..., @@ -30,7 +31,7 @@ class JSONField(CheckFieldDefaultMixin, Field[_A | Combinable, _A]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: Any | Callable[[], Any] | None = ..., editable: bool = ..., @@ -52,6 +53,7 @@ class JSONField(CheckFieldDefaultMixin, Field[_A | Combinable, _A]): def __new__( cls, verbose_name: str | None = ..., + *, name: str | None = ..., encoder: type[json.JSONEncoder] = ..., decoder: type[json.JSONDecoder] = ..., @@ -59,7 +61,7 @@ class JSONField(CheckFieldDefaultMixin, Field[_A | Combinable, _A]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: Any | Callable[[], Any] = ..., editable: bool = ..., diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index 28f9042cd..758ef63ec 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -86,6 +86,7 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]): on_delete: _OnDeleteOptions, from_fields: Sequence[str], to_fields: Sequence[str], + *, rel: ForeignObjectRel | None = ..., related_name: str | None = ..., related_query_name: str | None = ..., @@ -99,7 +100,7 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _M | Callable[[], _M] | None = ..., editable: bool = ..., @@ -122,6 +123,7 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]): on_delete: _OnDeleteOptions, from_fields: Sequence[str], to_fields: Sequence[str], + *, rel: ForeignObjectRel | None = ..., related_name: str | None = ..., related_query_name: str | None = ..., @@ -135,7 +137,7 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _M | Callable[[], _M] = ..., editable: bool = ..., @@ -163,6 +165,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): cls, to: type[_M] | str, on_delete: _OnDeleteOptions, + *, to_field: str | None = ..., related_name: str | None = ..., related_query_name: str | None = ..., @@ -176,7 +179,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _M | Callable[[], _M] | None = ..., editable: bool = ..., @@ -197,6 +200,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): cls, to: type[_M] | str, on_delete: _OnDeleteOptions, + *, to_field: str | None = ..., related_name: str | None = ..., related_query_name: str | None = ..., @@ -210,7 +214,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): max_length: int | None = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _M | Callable[[], _M] = ..., editable: bool = ..., @@ -247,6 +251,7 @@ class OneToOneField(Generic[_M], ForeignKey[_M]): cls, to: type[_M] | str, on_delete: _OnDeleteOptions, + *, to_field: str | None = ..., related_name: str | None = ..., related_query_name: str | None = ..., @@ -260,7 +265,7 @@ class OneToOneField(Generic[_M], ForeignKey[_M]): max_length: int | None = ..., unique: Literal[True] = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[False] = False, db_index: bool = ..., default: _M | Callable[[], _M] | None = ..., editable: bool = ..., @@ -281,6 +286,7 @@ class OneToOneField(Generic[_M], ForeignKey[_M]): cls, to: type[_M] | str, on_delete: _OnDeleteOptions, + *, to_field: str | None = ..., related_name: str | None = ..., related_query_name: str | None = ..., @@ -294,7 +300,7 @@ class OneToOneField(Generic[_M], ForeignKey[_M]): max_length: int | None = ..., unique: Literal[True] = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[True], db_index: bool = ..., default: _M | Callable[[], _M] = ..., editable: bool = ...,