Skip to content

Commit 29e2ca8

Browse files
authored
Allow tuples for some TypedModelMeta fields (#2594)
Django supports both `list` and `tuple` in many places, including here.
1 parent 9bf3e70 commit 29e2ca8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ext/django_stubs_ext/db/models/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import ClassVar, Literal, Union
66

77
from django.db.models import BaseConstraint, Index, OrderBy
8+
from django.utils.datastructures import _ListOrTuple
89

910
from django_stubs_ext import StrOrPromise
1011

@@ -28,16 +29,16 @@ class TypedModelMeta:
2829
managed: ClassVar[bool] # default: True
2930
order_with_respect_to: ClassVar[str]
3031
ordering: ClassVar[Sequence[Union[str, OrderBy]]]
31-
permissions: ClassVar[list[tuple[str, str]]]
32+
permissions: ClassVar[_ListOrTuple[tuple[str, str]]]
3233
default_permissions: ClassVar[Sequence[str]] # default: ("add", "change", "delete", "view")
3334
proxy: ClassVar[bool] # default: False
34-
required_db_features: ClassVar[list[str]]
35+
required_db_features: ClassVar[_ListOrTuple[str]]
3536
required_db_vendor: ClassVar[Literal["sqlite", "postgresql", "mysql", "oracle"]]
3637
select_on_save: ClassVar[bool] # default: False
37-
indexes: ClassVar[list[Index]]
38+
indexes: ClassVar[_ListOrTuple[Index]]
3839
unique_together: ClassVar[Union[Sequence[Sequence[str]], Sequence[str]]]
3940
index_together: ClassVar[Union[Sequence[Sequence[str]], Sequence[str]]] # Deprecated in Django 4.2
40-
constraints: ClassVar[list[BaseConstraint]]
41+
constraints: ClassVar[_ListOrTuple[BaseConstraint]]
4142
verbose_name: ClassVar[StrOrPromise]
4243
verbose_name_plural: ClassVar[StrOrPromise]
4344

0 commit comments

Comments
 (0)