django-types 0.19.0__py3-none-any.whl → 0.20.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django-stubs/contrib/admin/__init__.pyi +1 -0
- django-stubs/contrib/admin/options.pyi +63 -35
- django-stubs/contrib/admin/templatetags/base.pyi +1 -1
- django-stubs/contrib/admin/views/main.pyi +2 -1
- django-stubs/contrib/auth/__init__.pyi +14 -4
- django-stubs/contrib/auth/base_user.pyi +1 -1
- django-stubs/contrib/auth/models.pyi +28 -26
- django-stubs/contrib/contenttypes/fields.pyi +1 -1
- django-stubs/contrib/contenttypes/models.pyi +3 -1
- django-stubs/contrib/postgres/fields/array.pyi +5 -3
- django-stubs/contrib/postgres/fields/citext.pyi +12 -6
- django-stubs/contrib/postgres/fields/hstore.pyi +4 -2
- django-stubs/core/cache/backends/base.pyi +9 -0
- django-stubs/core/exceptions.pyi +16 -11
- django-stubs/core/files/base.pyi +1 -1
- django-stubs/core/files/storage.pyi +2 -2
- django-stubs/core/mail/message.pyi +6 -6
- django-stubs/core/serializers/json.pyi +1 -1
- django-stubs/core/servers/basehttp.pyi +2 -2
- django-stubs/db/migrations/recorder.pyi +1 -1
- django-stubs/db/models/base.pyi +0 -1
- django-stubs/db/models/constraints.pyi +1 -0
- django-stubs/db/models/enums.pyi +9 -19
- django-stubs/db/models/expressions.pyi +1 -1
- django-stubs/db/models/fields/__init__.pyi +225 -75
- django-stubs/db/models/fields/files.pyi +2 -2
- django-stubs/db/models/fields/json.pyi +9 -5
- django-stubs/db/models/fields/related.pyi +40 -18
- django-stubs/db/models/fields/related_descriptors.pyi +3 -3
- django-stubs/db/models/functions/__init__.pyi +2 -0
- django-stubs/db/models/functions/comparison.pyi +8 -0
- django-stubs/db/models/manager.pyi +11 -6
- django-stubs/db/models/query.pyi +4 -1
- django-stubs/db/models/query_utils.pyi +1 -0
- django-stubs/db/transaction.pyi +7 -1
- django-stubs/forms/boundfield.pyi +3 -1
- django-stubs/forms/forms.pyi +28 -35
- django-stubs/forms/formsets.pyi +98 -63
- django-stubs/forms/models.pyi +20 -14
- django-stubs/forms/renderers.pyi +26 -13
- django-stubs/forms/utils.pyi +38 -11
- django-stubs/http/cookie.pyi +3 -1
- django-stubs/http/request.pyi +37 -14
- django-stubs/http/response.pyi +38 -30
- django-stubs/template/backends/base.pyi +14 -5
- django-stubs/template/backends/django.pyi +24 -3
- django-stubs/template/backends/dummy.pyi +7 -6
- django-stubs/template/backends/jinja2.pyi +20 -2
- django-stubs/template/backends/utils.pyi +3 -3
- django-stubs/template/base.pyi +1 -1
- django-stubs/template/context.pyi +2 -2
- django-stubs/template/library.pyi +79 -15
- django-stubs/template/loader.pyi +5 -3
- django-stubs/template/response.pyi +3 -3
- django-stubs/template/utils.pyi +6 -4
- django-stubs/test/client.pyi +176 -20
- django-stubs/test/testcases.pyi +2 -2
- django-stubs/test/utils.pyi +41 -55
- django-stubs/urls/conf.pyi +7 -0
- django-stubs/utils/datastructures.pyi +3 -3
- django-stubs/utils/deconstruct.pyi +10 -2
- django-stubs/utils/log.pyi +1 -1
- django-stubs/utils/six.pyi +1 -1
- django-stubs/views/decorators/csrf.pyi +1 -1
- {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/METADATA +8 -3
- {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/RECORD +68 -68
- {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/WHEEL +1 -1
- {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/LICENSE.txt +0 -0
|
@@ -81,11 +81,11 @@ class FileField(Field[FileDescriptor, FileDescriptor]):
|
|
|
81
81
|
def generate_filename(self, instance: Model | None, filename: str) -> str: ...
|
|
82
82
|
|
|
83
83
|
class ImageFileDescriptor(FileDescriptor):
|
|
84
|
-
field: ImageField
|
|
84
|
+
field: ImageField # pyright: ignore[reportIncompatibleVariableOverride]
|
|
85
85
|
def __set__(self, instance: Model, value: str | None) -> None: ...
|
|
86
86
|
|
|
87
87
|
class ImageFieldFile(ImageFile, FieldFile):
|
|
88
|
-
field: ImageField
|
|
88
|
+
field: ImageField # pyright: ignore[reportIncompatibleVariableOverride]
|
|
89
89
|
def delete(self, save: bool = ...) -> None: ...
|
|
90
90
|
|
|
91
91
|
class ImageField(FileField):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from collections.abc import Callable, Iterable
|
|
3
3
|
from typing import Any, TypeVar, overload
|
|
4
|
-
from typing_extensions import Literal
|
|
4
|
+
from typing_extensions import Literal, Self
|
|
5
5
|
|
|
6
6
|
from django.db.models import lookups
|
|
7
7
|
from django.db.models.expressions import Combinable
|
|
@@ -20,9 +20,10 @@ class JSONField(CheckFieldDefaultMixin, Field[_A | Combinable, _A]):
|
|
|
20
20
|
def get_transform(self, name: Any) -> Any: ...
|
|
21
21
|
def value_to_string(self, obj: Any) -> Any: ...
|
|
22
22
|
@overload
|
|
23
|
-
def __new__(
|
|
23
|
+
def __new__(
|
|
24
24
|
cls,
|
|
25
25
|
verbose_name: str | None = ...,
|
|
26
|
+
*,
|
|
26
27
|
name: str | None = ...,
|
|
27
28
|
encoder: type[json.JSONEncoder] = ...,
|
|
28
29
|
decoder: type[json.JSONDecoder] = ...,
|
|
@@ -30,7 +31,7 @@ class JSONField(CheckFieldDefaultMixin, Field[_A | Combinable, _A]):
|
|
|
30
31
|
max_length: int | None = ...,
|
|
31
32
|
unique: bool = ...,
|
|
32
33
|
blank: bool = ...,
|
|
33
|
-
null: Literal[False] =
|
|
34
|
+
null: Literal[False] = False,
|
|
34
35
|
db_index: bool = ...,
|
|
35
36
|
default: Any | Callable[[], Any] | None = ...,
|
|
36
37
|
editable: bool = ...,
|
|
@@ -52,6 +53,7 @@ class JSONField(CheckFieldDefaultMixin, Field[_A | Combinable, _A]):
|
|
|
52
53
|
def __new__(
|
|
53
54
|
cls,
|
|
54
55
|
verbose_name: str | None = ...,
|
|
56
|
+
*,
|
|
55
57
|
name: str | None = ...,
|
|
56
58
|
encoder: type[json.JSONEncoder] = ...,
|
|
57
59
|
decoder: type[json.JSONDecoder] = ...,
|
|
@@ -59,7 +61,7 @@ class JSONField(CheckFieldDefaultMixin, Field[_A | Combinable, _A]):
|
|
|
59
61
|
max_length: int | None = ...,
|
|
60
62
|
unique: bool = ...,
|
|
61
63
|
blank: bool = ...,
|
|
62
|
-
null: Literal[True]
|
|
64
|
+
null: Literal[True],
|
|
63
65
|
db_index: bool = ...,
|
|
64
66
|
default: Any | Callable[[], Any] = ...,
|
|
65
67
|
editable: bool = ...,
|
|
@@ -135,6 +137,8 @@ class KeyTransform(Transform):
|
|
|
135
137
|
class KeyTextTransform(KeyTransform):
|
|
136
138
|
postgres_operator: str = ...
|
|
137
139
|
postgres_nested_operator: str = ...
|
|
140
|
+
@classmethod
|
|
141
|
+
def from_lookup(cls, lookup: str) -> Self: ...
|
|
138
142
|
|
|
139
143
|
class KeyTransformTextLookupMixin:
|
|
140
144
|
def __init__(self, key_transform: Any, *args: Any, **kwargs: Any) -> None: ...
|
|
@@ -187,4 +191,4 @@ class KeyTransformFactory:
|
|
|
187
191
|
def __init__(self, key_name: Any) -> None: ...
|
|
188
192
|
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
|
189
193
|
|
|
190
|
-
KT
|
|
194
|
+
KT = KeyTextTransform.from_lookup
|
|
@@ -54,10 +54,10 @@ _ErrorMessagesToOverride = dict[str, Any]
|
|
|
54
54
|
RECURSIVE_RELATIONSHIP_CONSTANT: str = ...
|
|
55
55
|
|
|
56
56
|
class RelatedField(FieldCacheMixin, Generic[_ST, _GT], Field[_ST, _GT]):
|
|
57
|
-
one_to_many: bool = ...
|
|
58
|
-
one_to_one: bool = ...
|
|
59
|
-
many_to_many: bool = ...
|
|
60
|
-
many_to_one: bool = ...
|
|
57
|
+
one_to_many: bool = ... # pyright: ignore[reportIncompatibleVariableOverride]
|
|
58
|
+
one_to_one: bool = ... # pyright: ignore[reportIncompatibleVariableOverride]
|
|
59
|
+
many_to_many: bool = ... # pyright: ignore[reportIncompatibleVariableOverride]
|
|
60
|
+
many_to_one: bool = ... # pyright: ignore[reportIncompatibleVariableOverride]
|
|
61
61
|
related_model: type[_GT] = ...
|
|
62
62
|
opts: Any = ...
|
|
63
63
|
def get_forward_related_filter(self, obj: Model) -> dict[str, int | UUID]: ...
|
|
@@ -74,10 +74,18 @@ class RelatedField(FieldCacheMixin, Generic[_ST, _GT], Field[_ST, _GT]):
|
|
|
74
74
|
_M = TypeVar("_M", bound=Model | None)
|
|
75
75
|
|
|
76
76
|
class ForeignObject(Generic[_M], RelatedField[_M, _M]):
|
|
77
|
-
one_to_many: Literal[
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
one_to_many: Literal[ # pyright: ignore[reportIncompatibleVariableOverride]
|
|
78
|
+
False
|
|
79
|
+
] = ...
|
|
80
|
+
one_to_one: Literal[ # pyright: ignore[reportIncompatibleVariableOverride]
|
|
81
|
+
False
|
|
82
|
+
] = ...
|
|
83
|
+
many_to_many: Literal[ # pyright: ignore[reportIncompatibleVariableOverride]
|
|
84
|
+
False
|
|
85
|
+
] = ...
|
|
86
|
+
many_to_one: Literal[ # pyright: ignore[reportIncompatibleVariableOverride]
|
|
87
|
+
True
|
|
88
|
+
] = ...
|
|
81
89
|
related_model: type[_M] = ...
|
|
82
90
|
@overload
|
|
83
91
|
def __new__(
|
|
@@ -86,6 +94,7 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]):
|
|
|
86
94
|
on_delete: _OnDeleteOptions,
|
|
87
95
|
from_fields: Sequence[str],
|
|
88
96
|
to_fields: Sequence[str],
|
|
97
|
+
*,
|
|
89
98
|
rel: ForeignObjectRel | None = ...,
|
|
90
99
|
related_name: str | None = ...,
|
|
91
100
|
related_query_name: str | None = ...,
|
|
@@ -99,7 +108,7 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]):
|
|
|
99
108
|
max_length: int | None = ...,
|
|
100
109
|
unique: bool = ...,
|
|
101
110
|
blank: bool = ...,
|
|
102
|
-
null: Literal[False] =
|
|
111
|
+
null: Literal[False] = False,
|
|
103
112
|
db_index: bool = ...,
|
|
104
113
|
default: _M | Callable[[], _M] | None = ...,
|
|
105
114
|
editable: bool = ...,
|
|
@@ -122,6 +131,7 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]):
|
|
|
122
131
|
on_delete: _OnDeleteOptions,
|
|
123
132
|
from_fields: Sequence[str],
|
|
124
133
|
to_fields: Sequence[str],
|
|
134
|
+
*,
|
|
125
135
|
rel: ForeignObjectRel | None = ...,
|
|
126
136
|
related_name: str | None = ...,
|
|
127
137
|
related_query_name: str | None = ...,
|
|
@@ -135,7 +145,7 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]):
|
|
|
135
145
|
max_length: int | None = ...,
|
|
136
146
|
unique: bool = ...,
|
|
137
147
|
blank: bool = ...,
|
|
138
|
-
null: Literal[True]
|
|
148
|
+
null: Literal[True],
|
|
139
149
|
db_index: bool = ...,
|
|
140
150
|
default: _M | Callable[[], _M] = ...,
|
|
141
151
|
editable: bool = ...,
|
|
@@ -163,6 +173,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]):
|
|
|
163
173
|
cls,
|
|
164
174
|
to: type[_M] | str,
|
|
165
175
|
on_delete: _OnDeleteOptions,
|
|
176
|
+
*,
|
|
166
177
|
to_field: str | None = ...,
|
|
167
178
|
related_name: str | None = ...,
|
|
168
179
|
related_query_name: str | None = ...,
|
|
@@ -176,7 +187,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]):
|
|
|
176
187
|
max_length: int | None = ...,
|
|
177
188
|
unique: bool = ...,
|
|
178
189
|
blank: bool = ...,
|
|
179
|
-
null: Literal[False] =
|
|
190
|
+
null: Literal[False] = False,
|
|
180
191
|
db_index: bool = ...,
|
|
181
192
|
default: _M | Callable[[], _M] | None = ...,
|
|
182
193
|
editable: bool = ...,
|
|
@@ -197,6 +208,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]):
|
|
|
197
208
|
cls,
|
|
198
209
|
to: type[_M] | str,
|
|
199
210
|
on_delete: _OnDeleteOptions,
|
|
211
|
+
*,
|
|
200
212
|
to_field: str | None = ...,
|
|
201
213
|
related_name: str | None = ...,
|
|
202
214
|
related_query_name: str | None = ...,
|
|
@@ -210,7 +222,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]):
|
|
|
210
222
|
max_length: int | None = ...,
|
|
211
223
|
unique: bool = ...,
|
|
212
224
|
blank: bool = ...,
|
|
213
|
-
null: Literal[True]
|
|
225
|
+
null: Literal[True],
|
|
214
226
|
db_index: bool = ...,
|
|
215
227
|
default: _M | Callable[[], _M] = ...,
|
|
216
228
|
editable: bool = ...,
|
|
@@ -247,6 +259,7 @@ class OneToOneField(Generic[_M], ForeignKey[_M]):
|
|
|
247
259
|
cls,
|
|
248
260
|
to: type[_M] | str,
|
|
249
261
|
on_delete: _OnDeleteOptions,
|
|
262
|
+
*,
|
|
250
263
|
to_field: str | None = ...,
|
|
251
264
|
related_name: str | None = ...,
|
|
252
265
|
related_query_name: str | None = ...,
|
|
@@ -260,7 +273,7 @@ class OneToOneField(Generic[_M], ForeignKey[_M]):
|
|
|
260
273
|
max_length: int | None = ...,
|
|
261
274
|
unique: Literal[True] = ...,
|
|
262
275
|
blank: bool = ...,
|
|
263
|
-
null: Literal[False] =
|
|
276
|
+
null: Literal[False] = False,
|
|
264
277
|
db_index: bool = ...,
|
|
265
278
|
default: _M | Callable[[], _M] | None = ...,
|
|
266
279
|
editable: bool = ...,
|
|
@@ -281,6 +294,7 @@ class OneToOneField(Generic[_M], ForeignKey[_M]):
|
|
|
281
294
|
cls,
|
|
282
295
|
to: type[_M] | str,
|
|
283
296
|
on_delete: _OnDeleteOptions,
|
|
297
|
+
*,
|
|
284
298
|
to_field: str | None = ...,
|
|
285
299
|
related_name: str | None = ...,
|
|
286
300
|
related_query_name: str | None = ...,
|
|
@@ -294,7 +308,7 @@ class OneToOneField(Generic[_M], ForeignKey[_M]):
|
|
|
294
308
|
max_length: int | None = ...,
|
|
295
309
|
unique: Literal[True] = ...,
|
|
296
310
|
blank: bool = ...,
|
|
297
|
-
null: Literal[True]
|
|
311
|
+
null: Literal[True],
|
|
298
312
|
db_index: bool = ...,
|
|
299
313
|
default: _M | Callable[[], _M] = ...,
|
|
300
314
|
editable: bool = ...,
|
|
@@ -326,10 +340,18 @@ _MN = TypeVar("_MN", bound=Model)
|
|
|
326
340
|
class ManyToManyField(
|
|
327
341
|
Generic[_MM, _MN], RelatedField[Sequence[_MN], ManyToManyRelatedManager[_MM, _MN]]
|
|
328
342
|
):
|
|
329
|
-
one_to_many: Literal[
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
343
|
+
one_to_many: Literal[ # pyright: ignore[reportIncompatibleVariableOverride]
|
|
344
|
+
False
|
|
345
|
+
] = ...
|
|
346
|
+
one_to_one: Literal[ # pyright: ignore[reportIncompatibleVariableOverride]
|
|
347
|
+
False
|
|
348
|
+
] = ...
|
|
349
|
+
many_to_many: Literal[ # pyright: ignore[reportIncompatibleVariableOverride]
|
|
350
|
+
True
|
|
351
|
+
] = ...
|
|
352
|
+
many_to_one: Literal[ # pyright: ignore[reportIncompatibleVariableOverride]
|
|
353
|
+
False
|
|
354
|
+
] = ...
|
|
333
355
|
rel_class: Any = ...
|
|
334
356
|
description: Any = ...
|
|
335
357
|
has_null_arg: Any = ...
|
|
@@ -31,7 +31,7 @@ class ForwardManyToOneDescriptor:
|
|
|
31
31
|
|
|
32
32
|
class ForwardOneToOneDescriptor(ForwardManyToOneDescriptor):
|
|
33
33
|
RelatedObjectDoesNotExist: type[ObjectDoesNotExist]
|
|
34
|
-
field: OneToOneField[Any]
|
|
34
|
+
field: OneToOneField[Any] # pyright: ignore[reportIncompatibleVariableOverride]
|
|
35
35
|
def get_object(self, instance: Model) -> Model: ...
|
|
36
36
|
|
|
37
37
|
class ReverseOneToOneDescriptor:
|
|
@@ -64,8 +64,8 @@ class ReverseManyToOneDescriptor:
|
|
|
64
64
|
def create_reverse_many_to_one_manager(superclass: Any, rel: Any) -> Any: ...
|
|
65
65
|
|
|
66
66
|
class ManyToManyDescriptor(ReverseManyToOneDescriptor):
|
|
67
|
-
field: RelatedField[Any, Any]
|
|
68
|
-
rel: ManyToManyRel
|
|
67
|
+
field: RelatedField[Any, Any] # pyright: ignore[reportIncompatibleVariableOverride]
|
|
68
|
+
rel: ManyToManyRel # pyright: ignore[reportIncompatibleVariableOverride]
|
|
69
69
|
reverse: bool = ...
|
|
70
70
|
def __init__(self, rel: ManyToManyRel, reverse: bool = ...) -> None: ...
|
|
71
71
|
@property
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from .comparison import Cast as Cast
|
|
2
2
|
from .comparison import Coalesce as Coalesce
|
|
3
|
+
from .comparison import Collate as Collate
|
|
3
4
|
from .comparison import Greatest as Greatest
|
|
5
|
+
from .comparison import JSONObject as JSONObject
|
|
4
6
|
from .comparison import Least as Least
|
|
5
7
|
from .comparison import NullIf as NullIf
|
|
6
8
|
from .datetime import Extract as Extract
|
|
@@ -9,6 +9,14 @@ class Cast(Func):
|
|
|
9
9
|
) -> None: ...
|
|
10
10
|
|
|
11
11
|
class Coalesce(Func): ...
|
|
12
|
+
|
|
13
|
+
class Collate(Func):
|
|
14
|
+
def __init__(self, expression: Any, collation: str) -> None: ...
|
|
15
|
+
|
|
12
16
|
class Greatest(Func): ...
|
|
17
|
+
|
|
18
|
+
class JSONObject(Func):
|
|
19
|
+
def __init__(self, **fields: Any) -> None: ...
|
|
20
|
+
|
|
13
21
|
class Least(Func): ...
|
|
14
22
|
class NullIf(Func): ...
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from collections.abc import Iterable, MutableMapping
|
|
2
|
-
from typing import Any, Generic, TypeVar
|
|
2
|
+
from typing import Any, Callable, Generic, TypeVar
|
|
3
3
|
from typing_extensions import Self
|
|
4
4
|
|
|
5
5
|
from django.db.models.base import Model
|
|
@@ -19,21 +19,26 @@ class BaseManager(QuerySet[_T]):
|
|
|
19
19
|
def __init__(self) -> None: ...
|
|
20
20
|
def deconstruct(
|
|
21
21
|
self,
|
|
22
|
-
) -> tuple[
|
|
22
|
+
) -> tuple[
|
|
23
|
+
bool, str | None, str | None, tuple[Any, ...] | None, dict[str, Any] | None
|
|
24
|
+
]: ...
|
|
23
25
|
def check(self, **kwargs: Any) -> list[Any]: ...
|
|
24
26
|
@classmethod
|
|
25
27
|
def from_queryset(
|
|
26
|
-
cls, queryset_class: type[QuerySet[
|
|
27
|
-
) ->
|
|
28
|
+
cls, queryset_class: type[QuerySet[_T]], class_name: str | None = ...
|
|
29
|
+
) -> type[Self]: ...
|
|
28
30
|
@classmethod
|
|
29
|
-
def _get_queryset_methods(
|
|
31
|
+
def _get_queryset_methods(
|
|
32
|
+
cls, queryset_class: type[QuerySet[_T]]
|
|
33
|
+
) -> dict[str, Callable[..., Any]]: ...
|
|
30
34
|
def contribute_to_class(self, model: type[Model], name: str) -> None: ...
|
|
31
35
|
def db_manager(
|
|
32
36
|
self, using: str | None = ..., hints: dict[str, Model] | None = ...
|
|
33
37
|
) -> Self: ...
|
|
34
38
|
def get_queryset(self) -> QuerySet[_T]: ...
|
|
35
39
|
|
|
36
|
-
class Manager(BaseManager[_T]):
|
|
40
|
+
class Manager(BaseManager[_T]):
|
|
41
|
+
_queryset_class: type[QuerySet[_T]]
|
|
37
42
|
|
|
38
43
|
class RelatedManager(Manager[_T]):
|
|
39
44
|
related_val: tuple[int, ...]
|
django-stubs/db/models/query.pyi
CHANGED
|
@@ -42,7 +42,7 @@ class _BaseQuerySet(Generic[_T], Sized):
|
|
|
42
42
|
def __and__(self, other: _BaseQuerySet[_T]) -> Self: ...
|
|
43
43
|
def __or__(self, other: _BaseQuerySet[_T]) -> Self: ...
|
|
44
44
|
def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
|
|
45
|
-
|
|
45
|
+
def aiterator(self, chunk_size: int = ...) -> AsyncIterator[_T]: ...
|
|
46
46
|
def aggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
|
|
47
47
|
async def aaggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
|
|
48
48
|
def get(self, *args: Any, **kwargs: Any) -> _T: ...
|
|
@@ -70,6 +70,9 @@ class _BaseQuerySet(Generic[_T], Sized):
|
|
|
70
70
|
def bulk_update(
|
|
71
71
|
self, objs: Iterable[_T], fields: Sequence[str], batch_size: int | None = ...
|
|
72
72
|
) -> int: ...
|
|
73
|
+
async def abulk_update(
|
|
74
|
+
self, objs: Iterable[_T], fields: Sequence[str], batch_size: int | None = ...
|
|
75
|
+
) -> int: ...
|
|
73
76
|
def get_or_create(
|
|
74
77
|
self, defaults: MutableMapping[str, Any] | None = ..., **kwargs: Any
|
|
75
78
|
) -> tuple[_T, bool]: ...
|
|
@@ -37,6 +37,7 @@ class Q(tree.Node):
|
|
|
37
37
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
|
38
38
|
def __or__(self, other: Any) -> Q: ...
|
|
39
39
|
def __and__(self, other: Any) -> Q: ...
|
|
40
|
+
def __xor__(self, other: Any) -> Q: ...
|
|
40
41
|
def __invert__(self) -> Q: ...
|
|
41
42
|
def resolve_expression(
|
|
42
43
|
self,
|
django-stubs/db/transaction.pyi
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from collections.abc import Callable, Iterator
|
|
2
2
|
from contextlib import contextmanager
|
|
3
|
+
from types import TracebackType
|
|
3
4
|
from typing import Any, TypeVar, overload
|
|
4
5
|
|
|
5
6
|
from django.db import ProgrammingError
|
|
@@ -35,7 +36,12 @@ class Atomic:
|
|
|
35
36
|
# When decorating, return the decorated function as-is, rather than clobbering it as ContextDecorator does.
|
|
36
37
|
def __call__(self, func: _C) -> _C: ...
|
|
37
38
|
def __enter__(self) -> None: ...
|
|
38
|
-
def __exit__(
|
|
39
|
+
def __exit__(
|
|
40
|
+
self,
|
|
41
|
+
exc_type: type[BaseException] | None,
|
|
42
|
+
exc_value: BaseException | None,
|
|
43
|
+
traceback: TracebackType | None,
|
|
44
|
+
) -> None: ...
|
|
39
45
|
|
|
40
46
|
# Bare decorator
|
|
41
47
|
@overload
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from collections.abc import Iterable
|
|
1
2
|
from typing import Any
|
|
2
3
|
|
|
3
4
|
from django.forms.fields import Field
|
|
@@ -18,9 +19,10 @@ class BoundField:
|
|
|
18
19
|
label: str = ...
|
|
19
20
|
help_text: str = ...
|
|
20
21
|
def __init__(self, form: BaseForm, field: Field, name: str) -> None: ...
|
|
22
|
+
@property
|
|
21
23
|
def subwidgets(self) -> list[BoundWidget]: ...
|
|
22
24
|
def __bool__(self) -> bool: ...
|
|
23
|
-
def __iter__(self) ->
|
|
25
|
+
def __iter__(self) -> Iterable[BoundWidget]: ...
|
|
24
26
|
def __len__(self) -> int: ...
|
|
25
27
|
def __getitem__(
|
|
26
28
|
self, idx: int | slice | str
|
django-stubs/forms/forms.pyi
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
from collections.abc import Iterator, Mapping
|
|
2
|
-
from typing import Any
|
|
1
|
+
from collections.abc import Iterator, Mapping
|
|
2
|
+
from typing import Any, ClassVar
|
|
3
3
|
|
|
4
4
|
from django.core.exceptions import ValidationError as ValidationError
|
|
5
5
|
from django.core.files import uploadedfile
|
|
6
|
-
from django.db.models.options import Options
|
|
7
6
|
from django.forms.boundfield import BoundField
|
|
8
7
|
from django.forms.fields import Field
|
|
9
8
|
from django.forms.renderers import BaseRenderer
|
|
10
|
-
from django.forms.utils import ErrorDict, ErrorList
|
|
9
|
+
from django.forms.utils import ErrorDict, ErrorList, RenderableFormMixin
|
|
11
10
|
from django.forms.widgets import Media, MediaDefiningClass
|
|
12
11
|
from django.utils.datastructures import MultiValueDict
|
|
13
12
|
from django.utils.safestring import SafeText
|
|
14
13
|
|
|
15
14
|
class DeclarativeFieldsMetaclass(MediaDefiningClass): ...
|
|
16
15
|
|
|
17
|
-
class BaseForm:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
fields: dict[str, Any] = ...
|
|
34
|
-
renderer: BaseRenderer = ...
|
|
35
|
-
cleaned_data: Any = ...
|
|
16
|
+
class BaseForm(RenderableFormMixin):
|
|
17
|
+
default_renderer: type[BaseRenderer]
|
|
18
|
+
field_order: list[str] | None
|
|
19
|
+
use_required_attribute: bool
|
|
20
|
+
is_bound: bool
|
|
21
|
+
data: dict[str, Any]
|
|
22
|
+
files: MultiValueDict[str, uploadedfile.UploadedFile]
|
|
23
|
+
auto_id: bool | str
|
|
24
|
+
initial: dict[str, Any]
|
|
25
|
+
error_class: type[ErrorList]
|
|
26
|
+
prefix: str | None
|
|
27
|
+
label_suffix: str
|
|
28
|
+
empty_permitted: bool
|
|
29
|
+
fields: dict[str, Field]
|
|
30
|
+
renderer: BaseRenderer
|
|
31
|
+
cleaned_data: dict[str, Any]
|
|
36
32
|
def __init__(
|
|
37
33
|
self,
|
|
38
34
|
data: Mapping[str, Any] | None = ...,
|
|
@@ -43,9 +39,9 @@ class BaseForm:
|
|
|
43
39
|
error_class: type[ErrorList] = ...,
|
|
44
40
|
label_suffix: str | None = ...,
|
|
45
41
|
empty_permitted: bool = ...,
|
|
46
|
-
field_order:
|
|
42
|
+
field_order: list[str] | None = ...,
|
|
47
43
|
use_required_attribute: bool | None = ...,
|
|
48
|
-
renderer:
|
|
44
|
+
renderer: type[BaseRenderer] | None = ...,
|
|
49
45
|
) -> None: ...
|
|
50
46
|
def order_fields(self, field_order: list[str] | None) -> None: ...
|
|
51
47
|
def __iter__(self) -> Iterator[BoundField]: ...
|
|
@@ -55,12 +51,9 @@ class BaseForm:
|
|
|
55
51
|
def is_valid(self) -> bool: ...
|
|
56
52
|
def add_prefix(self, field_name: str) -> str: ...
|
|
57
53
|
def add_initial_prefix(self, field_name: str) -> str: ...
|
|
58
|
-
def as_table(self) -> SafeText: ...
|
|
59
|
-
def as_ul(self) -> SafeText: ...
|
|
60
|
-
def as_p(self) -> SafeText: ...
|
|
61
54
|
def non_field_errors(self) -> ErrorList: ...
|
|
62
55
|
def add_error(self, field: str | None, error: ValidationError | str) -> None: ...
|
|
63
|
-
def has_error(self, field:
|
|
56
|
+
def has_error(self, field: str, code: str | None = ...) -> bool: ...
|
|
64
57
|
def full_clean(self) -> None: ...
|
|
65
58
|
def clean(self) -> dict[str, Any]: ...
|
|
66
59
|
def has_changed(self) -> bool: ...
|
|
@@ -68,9 +61,9 @@ class BaseForm:
|
|
|
68
61
|
def changed_data(self) -> list[str]: ...
|
|
69
62
|
@property
|
|
70
63
|
def media(self) -> Media: ...
|
|
71
|
-
def is_multipart(self) ->
|
|
72
|
-
def hidden_fields(self) ->
|
|
73
|
-
def visible_fields(self) ->
|
|
64
|
+
def is_multipart(self) -> bool: ...
|
|
65
|
+
def hidden_fields(self) -> list[BoundField]: ...
|
|
66
|
+
def visible_fields(self) -> list[BoundField]: ...
|
|
74
67
|
def get_initial_for_field(self, field: Field, field_name: str) -> Any: ...
|
|
75
68
|
def _html_output(
|
|
76
69
|
self,
|
|
@@ -81,6 +74,6 @@ class BaseForm:
|
|
|
81
74
|
errors_on_separate_row: bool,
|
|
82
75
|
) -> SafeText: ...
|
|
83
76
|
|
|
84
|
-
class Form(BaseForm):
|
|
85
|
-
base_fields: dict[str, Field]
|
|
86
|
-
declared_fields: dict[str, Field]
|
|
77
|
+
class Form(BaseForm, metaclass=DeclarativeFieldsMetaclass):
|
|
78
|
+
base_fields: ClassVar[dict[str, Field]]
|
|
79
|
+
declared_fields: ClassVar[dict[str, Field]]
|