mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
Compare commits
529 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28afe59881 | ||
|
|
54e5ecc16a | ||
|
|
418437b00c | ||
|
|
eb195b61e9 | ||
|
|
993dd816a4 | ||
|
|
e6dcfe4fc6 | ||
|
|
8f9e77ce39 | ||
|
|
a1334a70b9 | ||
|
|
a8d8561d0e | ||
|
|
bdc7db1154 | ||
|
|
49ed9c957f | ||
|
|
4829ce2200 | ||
|
|
9fe1a76779 | ||
|
|
153613eddb | ||
|
|
b6cb50e729 | ||
|
|
344dea06b5 | ||
|
|
01a9ad12e1 | ||
|
|
0a0e1985d7 | ||
|
|
f07477260f | ||
|
|
11c3f8cd11 | ||
|
|
159f8b95ba | ||
|
|
58c087f7f5 | ||
|
|
2e9adce5eb | ||
|
|
47bd07758b | ||
|
|
36d1778e2a | ||
|
|
caaa23ab8f | ||
|
|
cfd9379b58 | ||
|
|
362342d998 | ||
|
|
d3ff5415db | ||
|
|
eecf13a2fe | ||
|
|
d9c851abce | ||
|
|
896cbe4752 | ||
|
|
f3e0872d6e | ||
|
|
4cb13a6ac5 | ||
|
|
19d695b1da | ||
|
|
16326e999c | ||
|
|
517ae648e5 | ||
|
|
3e0f144148 | ||
|
|
8a68111ce5 | ||
|
|
9f966a8056 | ||
|
|
0c41d0c6e9 | ||
|
|
e798b496c0 | ||
|
|
01af2ff588 | ||
|
|
aab8acf2ea | ||
|
|
1c4a7d25c7 | ||
|
|
a0d61c0de3 | ||
|
|
e837dac26a | ||
|
|
bbdf15a6ec | ||
|
|
f08b428027 | ||
|
|
44151c485d | ||
|
|
a3624dec36 | ||
|
|
9a9a0123c7 | ||
|
|
d3d854dac8 | ||
|
|
6dc2c32382 | ||
|
|
695cdb16ca | ||
|
|
cb1fa08a82 | ||
|
|
e2f6abe579 | ||
|
|
ffb6551eb4 | ||
|
|
40c8bfa510 | ||
|
|
402b7d563f | ||
|
|
92eb068a04 | ||
|
|
9d4d06f8b3 | ||
|
|
d746e3f5e4 | ||
|
|
8729a74f81 | ||
|
|
56361b353e | ||
|
|
b71c9ad282 | ||
|
|
ce370ea79f | ||
|
|
2a732fd257 | ||
|
|
645ee97e78 | ||
|
|
5bc3759ea2 | ||
|
|
534a028ea2 | ||
|
|
87856754ea | ||
|
|
2f7fac2eaf | ||
|
|
5ff99fd047 | ||
|
|
f77ebcd22c | ||
|
|
34b126e3da | ||
|
|
6e5f5f2cdb | ||
|
|
95252cde60 | ||
|
|
6ef2cf0331 | ||
|
|
9f3b95841b | ||
|
|
e764b1cf4c | ||
|
|
8a64d87917 | ||
|
|
60f3f9dd9f | ||
|
|
ca10ee9242 | ||
|
|
f651f27ddf | ||
|
|
3915aa0639 | ||
|
|
97ec2ee43b | ||
|
|
19c73a106d | ||
|
|
92ef5d9d95 | ||
|
|
f16d1b8cb6 | ||
|
|
c3cdc1c2d5 | ||
|
|
3704d0ab98 | ||
|
|
b1d619edb2 | ||
|
|
e680326c72 | ||
|
|
574a87e68c | ||
|
|
82ae1751ed | ||
|
|
69042783b1 | ||
|
|
391bbc59d5 | ||
|
|
28c76df3b2 | ||
|
|
3d2534ea8d | ||
|
|
54f5f63e71 | ||
|
|
4c5723d368 | ||
|
|
7e0e43135d | ||
|
|
e05b84e32d | ||
|
|
71751d3795 | ||
|
|
25f92e8e56 | ||
|
|
28d47c7e93 | ||
|
|
197cb4058e | ||
|
|
dac2b31fb2 | ||
|
|
8d2600136a | ||
|
|
570772f973 | ||
|
|
d5c1bfb12a | ||
|
|
64cbb0f70e | ||
|
|
6f5a39625e | ||
|
|
bf604a0398 | ||
|
|
92c8dfc93f | ||
|
|
c10c55052c | ||
|
|
96914e466b | ||
|
|
90ed7f332d | ||
|
|
a801501151 | ||
|
|
8ea59985df | ||
|
|
2964ed53d7 | ||
|
|
1b9176f994 | ||
|
|
54d0d018c6 | ||
|
|
1af3a12f2c | ||
|
|
7af89ee6a6 | ||
|
|
afa16bfb74 | ||
|
|
f77073157b | ||
|
|
fe3b95c611 | ||
|
|
d0f9730c53 | ||
|
|
0fdd678d65 | ||
|
|
2397065fa6 | ||
|
|
04023a9f31 | ||
|
|
95e6c94319 | ||
|
|
d96aee7a8b | ||
|
|
2489bb9b04 | ||
|
|
3a8f278c88 | ||
|
|
85b65b4578 | ||
|
|
150e8e862a | ||
|
|
5b3088a17a | ||
|
|
f89a0fbbaa | ||
|
|
438f8b5829 | ||
|
|
836d5acd8f | ||
|
|
bfae51e64c | ||
|
|
e3801918e3 | ||
|
|
6f296b0a91 | ||
|
|
7ba578f6b2 | ||
|
|
cb123de105 | ||
|
|
38135f2d1f | ||
|
|
998b659749 | ||
|
|
72f69e1c5e | ||
|
|
d666ecd36f | ||
|
|
c1af26c027 | ||
|
|
3c3dfcbc9f | ||
|
|
1196336e3b | ||
|
|
665f4d8ea1 | ||
|
|
b3ed9e4827 | ||
|
|
fb1593630a | ||
|
|
031d42a75d | ||
|
|
f7e1cfc6c7 | ||
|
|
d0c25e3bce | ||
|
|
1c31e71ffc | ||
|
|
6b3b6be3c1 | ||
|
|
5832605053 | ||
|
|
31e795016f | ||
|
|
0cba3f9fd6 | ||
|
|
f02050911f | ||
|
|
e8e6fca78c | ||
|
|
ade48b6546 | ||
|
|
b8f29027d8 | ||
|
|
eba3f6cb15 | ||
|
|
5a45544e76 | ||
|
|
8c2de7da56 | ||
|
|
d43c6dc7e2 | ||
|
|
f7e2109e06 | ||
|
|
cea62abf5a | ||
|
|
3b69ec6a72 | ||
|
|
7e794534c0 | ||
|
|
f5f33b061d | ||
|
|
58b26fdbd3 | ||
|
|
9ca79c24a2 | ||
|
|
540e28f4c6 | ||
|
|
4ac43c6ed6 | ||
|
|
cadd6c963b | ||
|
|
041754f817 | ||
|
|
c0c5d1e588 | ||
|
|
f824003cc4 | ||
|
|
58f1833cab | ||
|
|
cbb6a7a9ac | ||
|
|
2c4827bbaf | ||
|
|
5a151bf851 | ||
|
|
cbc7159995 | ||
|
|
df4c17a947 | ||
|
|
445abc046c | ||
|
|
557b7a4fa3 | ||
|
|
8343d76895 | ||
|
|
8d986a0f43 | ||
|
|
e9a90ebff0 | ||
|
|
7b74a6944a | ||
|
|
83f11a0fc6 | ||
|
|
2829faf1af | ||
|
|
d061e84cc7 | ||
|
|
3a9263dc62 | ||
|
|
14aea2b4d4 | ||
|
|
287c64d6fb | ||
|
|
6601121db2 | ||
|
|
87d59c7c1a | ||
|
|
8402e7c53e | ||
|
|
dceb075152 | ||
|
|
7e3f4bfa02 | ||
|
|
db9ff6aaf6 | ||
|
|
717be5940f | ||
|
|
b939bc96b7 | ||
|
|
02bdf5be95 | ||
|
|
4d4b0003bd | ||
|
|
e143ba568c | ||
|
|
32c0cbca45 | ||
|
|
acc3ca4205 | ||
|
|
be3fc259d5 | ||
|
|
7725b416b6 | ||
|
|
2c23d8e70f | ||
|
|
5910bd1b25 | ||
|
|
963d50c717 | ||
|
|
7407b93151 | ||
|
|
afcd0d9293 | ||
|
|
a85dbff793 | ||
|
|
68aebe2528 | ||
|
|
d3dca5b408 | ||
|
|
c69090ec5b | ||
|
|
29ac1c3017 | ||
|
|
23ad65033b | ||
|
|
64720f492c | ||
|
|
a8fdd4c673 | ||
|
|
813dd8cc1a | ||
|
|
2b53fa5a1a | ||
|
|
e3ea84143f | ||
|
|
82e3aa5464 | ||
|
|
5b9a467cf0 | ||
|
|
4a4dc53c4d | ||
|
|
77fd46987d | ||
|
|
9291164a6b | ||
|
|
0c3e06e875 | ||
|
|
b8379d4fe6 | ||
|
|
caa0e60743 | ||
|
|
de4fa92441 | ||
|
|
dce0c0e930 | ||
|
|
fc9a335dfd | ||
|
|
5fc39ff110 | ||
|
|
e95b40ef52 | ||
|
|
c91a6d1d5b | ||
|
|
d7e8222163 | ||
|
|
09767210ec | ||
|
|
656105bab2 | ||
|
|
ff7bf33e9c | ||
|
|
d94b7b0c6a | ||
|
|
7bf1664307 | ||
|
|
0545c2d3ea | ||
|
|
825931da9f | ||
|
|
737fd239b6 | ||
|
|
7f476057b0 | ||
|
|
d31512854a | ||
|
|
552de422dc | ||
|
|
a9978cc021 | ||
|
|
bb08212b20 | ||
|
|
5d2efdb80b | ||
|
|
27793ecd32 | ||
|
|
dddcb20fe4 | ||
|
|
ac40b80764 | ||
|
|
6b21a0476d | ||
|
|
735b58e9bf | ||
|
|
b4cd9757b0 | ||
|
|
1b6c337aef | ||
|
|
bc42cc2fa1 | ||
|
|
62dac1d468 | ||
|
|
409c01eb24 | ||
|
|
a0a2ecaf46 | ||
|
|
4c21855641 | ||
|
|
6466c57c69 | ||
|
|
0bb41bc791 | ||
|
|
8894de0a04 | ||
|
|
a019fe9715 | ||
|
|
a97d76020c | ||
|
|
ae8e42dd53 | ||
|
|
64049b60b0 | ||
|
|
b6a5ccabdf | ||
|
|
e6d7a570e8 | ||
|
|
6332620443 | ||
|
|
df021f6baa | ||
|
|
57796077c6 | ||
|
|
46c48b504f | ||
|
|
4dfa363521 | ||
|
|
5b2aacddba | ||
|
|
2c001fd8a7 | ||
|
|
a0db24c764 | ||
|
|
39fb48b08a | ||
|
|
d7d379e1cd | ||
|
|
6962b42cba | ||
|
|
df77299c2f | ||
|
|
b86d33c718 | ||
|
|
fa57fb0cbf | ||
|
|
248504c25a | ||
|
|
fee4aad3d0 | ||
|
|
fc9843bea6 | ||
|
|
5bb1bc250d | ||
|
|
1721c997be | ||
|
|
bba6f769b5 | ||
|
|
07a9bcd4cb | ||
|
|
6ece759ca0 | ||
|
|
caf69ec1c9 | ||
|
|
f2e79d3bfb | ||
|
|
bfa77efef5 | ||
|
|
4f935edd47 | ||
|
|
03b59b872d | ||
|
|
0e72b2e6fc | ||
|
|
b81fbdeaa9 | ||
|
|
dc6101b569 | ||
|
|
d53121baae | ||
|
|
3c3122a93f | ||
|
|
7b1b1b6bfe | ||
|
|
2cb1f257eb | ||
|
|
b11a9a85f9 | ||
|
|
9c5a6be9a7 | ||
|
|
a9c1bcbbc6 | ||
|
|
f365297baf | ||
|
|
6859ec94b6 | ||
|
|
335c5765c3 | ||
|
|
b397ec04a9 | ||
|
|
f7db296e8b | ||
|
|
2f6af159f7 | ||
|
|
2799646723 | ||
|
|
d8230a4147 | ||
|
|
861c6653fd | ||
|
|
db7b46589f | ||
|
|
90cab6c5bf | ||
|
|
25165de80f | ||
|
|
2295b14214 | ||
|
|
a77d5b27d8 | ||
|
|
4e1c32f6a3 | ||
|
|
ea1294bd30 | ||
|
|
79d691732d | ||
|
|
629ba954b4 | ||
|
|
0e60b70ae4 | ||
|
|
dd5b98faf0 | ||
|
|
e634a5d460 | ||
|
|
d7d7e6c66e | ||
|
|
b66727657d | ||
|
|
86642e3ddd | ||
|
|
952e1c3ee9 | ||
|
|
5dd6eccdb5 | ||
|
|
fd06816cbb | ||
|
|
aeb435c8b3 | ||
|
|
13d19017b7 | ||
|
|
28a3f126ee | ||
|
|
304cb19de6 | ||
|
|
c57f4f7152 | ||
|
|
8a826fee1e | ||
|
|
37d85c2ca6 | ||
|
|
71fb0432f3 | ||
|
|
9288c34648 | ||
|
|
70050f28b9 | ||
|
|
4338c17970 | ||
|
|
91f789c38c | ||
|
|
0f5b45fba1 | ||
|
|
5b455b729a | ||
|
|
5c6be7ad12 | ||
|
|
5d0ee40ada | ||
|
|
77f15d7478 | ||
|
|
4f83d8d1bb | ||
|
|
b1a04d2f7d | ||
|
|
7c57143310 | ||
|
|
c3d76f9a1e | ||
|
|
fde071b883 | ||
|
|
324b961d74 | ||
|
|
86c63d790b | ||
|
|
050c1b8887 | ||
|
|
8978ad471f | ||
|
|
f7dfbefbd6 | ||
|
|
627daa55f5 | ||
|
|
194489ee8d | ||
|
|
1d2c7fb805 | ||
|
|
18c908bf98 | ||
|
|
e0e8814804 | ||
|
|
53f5d2214b | ||
|
|
9e4ed70fc5 | ||
|
|
18445f686f | ||
|
|
c962b8ac68 | ||
|
|
70c3126348 | ||
|
|
af8ecc5520 | ||
|
|
64f8870d0b | ||
|
|
df5c70c703 | ||
|
|
c09a97e005 | ||
|
|
0e30821ad3 | ||
|
|
2dadd681ff | ||
|
|
2dec3b4325 | ||
|
|
3b8c5d08e8 | ||
|
|
eaee3d390f | ||
|
|
b686751f19 | ||
|
|
73ea682356 | ||
|
|
9ea25f3e56 | ||
|
|
dacf88c692 | ||
|
|
3d14d07e4e | ||
|
|
6e6d1645d3 | ||
|
|
cda703a94b | ||
|
|
2bd018951b | ||
|
|
14ea848dd7 | ||
|
|
2d3b5492f0 | ||
|
|
194258ab8e | ||
|
|
116aa2c539 | ||
|
|
67c99434e5 | ||
|
|
5d8cdbcf29 | ||
|
|
78810f55b6 | ||
|
|
36662896bc | ||
|
|
e54dbb79c9 | ||
|
|
41f283552a | ||
|
|
ab73d53ae5 | ||
|
|
d24be4b35f | ||
|
|
9d60b472df | ||
|
|
632e063e22 | ||
|
|
66224416b5 | ||
|
|
e5b2496eb5 | ||
|
|
f980311be0 | ||
|
|
400a0f0486 | ||
|
|
882ec71d23 | ||
|
|
e9f9202ed1 | ||
|
|
6763217a80 | ||
|
|
6da5ead6f0 | ||
|
|
c382d6aa2f | ||
|
|
63a14f7107 | ||
|
|
dc33dd9493 | ||
|
|
4cb10390cf | ||
|
|
c1640b619f | ||
|
|
a08ad80a0d | ||
|
|
f30cd092f1 | ||
|
|
dcd9ee0bb8 | ||
|
|
26a80a8279 | ||
|
|
82de0a8791 | ||
|
|
79ebe20f2e | ||
|
|
587c2c484b | ||
|
|
4a22da29cb | ||
|
|
70378b8f40 | ||
|
|
b7f7713c5a | ||
|
|
2720b74242 | ||
|
|
563c0add5e | ||
|
|
3191740c6b | ||
|
|
cf7c263fb5 | ||
|
|
16a983152a | ||
|
|
9eb95fbab3 | ||
|
|
7aafca2e5d | ||
|
|
d05e739d75 | ||
|
|
faefdcca5b | ||
|
|
643f852775 | ||
|
|
6b7507206a | ||
|
|
5f6f597266 | ||
|
|
5c6aa9a00b | ||
|
|
916df1efb6 | ||
|
|
dead370244 | ||
|
|
dcb4da378b | ||
|
|
d4cb729c93 | ||
|
|
faee26703e | ||
|
|
f7b586f038 | ||
|
|
56cd3bc77d | ||
|
|
11500f337d | ||
|
|
723d9fbfb7 | ||
|
|
3fb3bbcf19 | ||
|
|
191496ed72 | ||
|
|
d43cb1fcd7 | ||
|
|
2559901ff3 | ||
|
|
0c121d65d1 | ||
|
|
d18fc0bf5f | ||
|
|
c534e75aaf | ||
|
|
af30bb6c4a | ||
|
|
dbc9b49867 | ||
|
|
a9c1f35494 | ||
|
|
4ea4c3eddd | ||
|
|
e4d2b795e3 | ||
|
|
be0b2eebb2 | ||
|
|
38291e0651 | ||
|
|
69d4ccaf54 | ||
|
|
6c87ccf228 | ||
|
|
08bf5660bf | ||
|
|
7819165e42 | ||
|
|
3dcab64e07 | ||
|
|
5a08a99d8b | ||
|
|
6fcccb3769 | ||
|
|
68c5da12f9 | ||
|
|
f5135dac9f | ||
|
|
2a6a0120a9 | ||
|
|
59b4d2e849 | ||
|
|
5f6b4bfd30 | ||
|
|
d03fddd96d | ||
|
|
e409dbdb82 | ||
|
|
880bab395b | ||
|
|
9461dbfb4f | ||
|
|
7a7f68ede4 | ||
|
|
3ccecebe3f | ||
|
|
55415458dc | ||
|
|
255e4af911 | ||
|
|
7f8477ff3d | ||
|
|
06724b762e | ||
|
|
19e9cd7ffc | ||
|
|
815c3ea497 | ||
|
|
b636d24051 | ||
|
|
c9e8fe53a5 | ||
|
|
b1153204d7 | ||
|
|
bb2d107e38 | ||
|
|
322addf6b2 | ||
|
|
8a952b416e | ||
|
|
1868100bd9 | ||
|
|
628c1224d6 | ||
|
|
978379c454 | ||
|
|
ece2b87318 | ||
|
|
f07a9ecbb8 | ||
|
|
e2bacbcbde | ||
|
|
835889e3a4 | ||
|
|
2914a0e560 | ||
|
|
e35c474cf8 | ||
|
|
5d8576348e | ||
|
|
145ce6bf18 | ||
|
|
db3f958d2c | ||
|
|
161d296871 | ||
|
|
d6c9aa1b00 | ||
|
|
2525b5b89f | ||
|
|
eacdd2ba09 | ||
|
|
b701d008f5 | ||
|
|
1afa079b0b | ||
|
|
38e841c4c7 | ||
|
|
bc4bc31722 | ||
|
|
0f1af6581d | ||
|
|
1b95bec5aa |
10
.editorconfig
Normal file
10
.editorconfig
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Check http://editorconfig.org for more information
|
||||||
|
# This is the main config file for this project:
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
trim_trailing_whitespace = true
|
||||||
35
.github/ISSUE_TEMPLATE/bug.md
vendored
Normal file
35
.github/ISSUE_TEMPLATE/bug.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
name: Bug
|
||||||
|
about: Create a report of something is not working
|
||||||
|
labels: 'bug'
|
||||||
|
---
|
||||||
|
|
||||||
|
# Bug report
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Hi, thanks for submitting a bug. We appreciate that.
|
||||||
|
|
||||||
|
But, we will need some information about what's wrong to help you.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## What's wrong
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Describe what is not working.
|
||||||
|
|
||||||
|
Please, attach a traceback.
|
||||||
|
We would also appreciate a failing test case.
|
||||||
|
That is EXTREMELY helpful!
|
||||||
|
-->
|
||||||
|
|
||||||
|
## How is that should be
|
||||||
|
|
||||||
|
<!-- Describe how it should work. -->
|
||||||
|
|
||||||
|
## System information
|
||||||
|
|
||||||
|
- OS:
|
||||||
|
- `python` version:
|
||||||
|
- `django` version:
|
||||||
|
- `mypy` version:
|
||||||
|
- `django-stubs` version:
|
||||||
29
.github/pull_request_template.md
vendored
Normal file
29
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# I have made things!
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Hi, thanks for submitting a Pull Request. We appreciate it.
|
||||||
|
|
||||||
|
Please, fill in all the required information
|
||||||
|
to make our review and merging processes easier.
|
||||||
|
|
||||||
|
Cheers!
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Related issues
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Mark what issues this Pull Request closes or references.
|
||||||
|
|
||||||
|
Format is:
|
||||||
|
- Closes #issue-number
|
||||||
|
- Refs #issue-number
|
||||||
|
|
||||||
|
Example. Refs #0
|
||||||
|
Documentation: https://blog.github.com/2013-05-14-closing-issues-via-pull-requests/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If you have any feedback, just write it here.
|
||||||
|
|
||||||
|
It can be whatever you want!
|
||||||
|
-->
|
||||||
20
.github/workflows/misspel.yml
vendored
Normal file
20
.github/workflows/misspel.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
name: misspell
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: sobolevn/misspell-fixer-action@0.1.0
|
||||||
|
- uses: peter-evans/create-pull-request@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
commit-message: 'Fixes by misspell-fixer'
|
||||||
|
title: 'Typos fix by misspell-fixer'
|
||||||
85
.github/workflows/test.yml
vendored
Normal file
85
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
name: test
|
||||||
|
|
||||||
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ['3.9']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-lint-${{ hashFiles('./dev-requirements.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-${{ matrix.python-version }}-lint-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pip install -U pip setuptools wheel
|
||||||
|
pip install -r ./dev-requirements.txt
|
||||||
|
|
||||||
|
- name: Run pre-commit
|
||||||
|
run: pre-commit install && pre-commit run --all-files
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ['3.7']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup system dependencies
|
||||||
|
run: sudo apt-get install binutils libproj-dev gdal-bin
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-test-${{ hashFiles('./dev-requirements.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-${{ matrix.python-version }}-test-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pip install -U pip setuptools wheel
|
||||||
|
pip install -r ./dev-requirements.txt
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: pytest
|
||||||
|
|
||||||
|
typecheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ['3.6', '3.7', '3.8', '3.9']
|
||||||
|
django-version: ['2.2', '3.0']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup system dependencies
|
||||||
|
run: sudo apt-get install binutils libproj-dev gdal-bin
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.django-version }}-typecheck-${{ hashFiles('./dev-requirements.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.django-version }}-typecheck-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pip install -U pip setuptools wheel
|
||||||
|
pip install -r ./dev-requirements.txt
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: python ./scripts/typecheck_tests.py --django_version="${{ matrix.django-version }}"
|
||||||
14
.gitignore
vendored
14
.gitignore
vendored
@@ -1,10 +1,12 @@
|
|||||||
*.egg-info
|
*.egg-info
|
||||||
__pycache__/
|
.DS_Store
|
||||||
out/
|
|
||||||
/test_sqlite.py
|
|
||||||
/django
|
|
||||||
.idea/
|
.idea/
|
||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
django-sources
|
.pytest_cache/
|
||||||
|
.venv/
|
||||||
|
__pycache__/
|
||||||
|
django-source/
|
||||||
|
out/
|
||||||
|
pip-wheel-metadata/
|
||||||
|
stubgen/
|
||||||
build/
|
build/
|
||||||
dist/
|
|
||||||
46
.pre-commit-config.yaml
Normal file
46
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# See https://pre-commit.com for more information
|
||||||
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
|
default_language_version:
|
||||||
|
python: python3.9
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v3.3.0
|
||||||
|
hooks:
|
||||||
|
- id: check-yaml
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: check-executables-have-shebangs
|
||||||
|
- id: debug-statements
|
||||||
|
- id: check-merge-conflict
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v2.7.3
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
args: ["--py36-plus"]
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-isort
|
||||||
|
rev: v5.6.4
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 20.8b1
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
|
rev: 3.8.4
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: mypy
|
||||||
|
name: mypy
|
||||||
|
entry: mypy
|
||||||
|
language: system
|
||||||
|
types: [ python ]
|
||||||
|
exclude: "scripts/|django_stubs_ext/"
|
||||||
|
args: [ "--config=mypy.ini", "--cache-dir=/dev/null", "--no-incremental" ]
|
||||||
|
- id: mypy
|
||||||
|
name: mypy (django_stubs_ext)
|
||||||
|
entry: mypy
|
||||||
|
language: system
|
||||||
|
types: [ python ]
|
||||||
|
files: "django_stubs_ext/|django_stubs_ext/tests/"
|
||||||
|
args: [ "--config=mypy.ini", "--cache-dir=/dev/null", "--no-incremental", "--strict" ]
|
||||||
31
.travis.yml
31
.travis.yml
@@ -1,31 +0,0 @@
|
|||||||
language: python
|
|
||||||
# cache package wheels (1 cache per python version)
|
|
||||||
cache: pip
|
|
||||||
# newer python versions are available only on xenial (while some older only on trusty) Ubuntu distribution
|
|
||||||
dist: xenial
|
|
||||||
sudo: required
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
include:
|
|
||||||
- name: "Run plugin test suite with python 3.7"
|
|
||||||
python: 3.7
|
|
||||||
script: |
|
|
||||||
set -e
|
|
||||||
pytest
|
|
||||||
|
|
||||||
- name: "Lint with black"
|
|
||||||
python: 3.7
|
|
||||||
script: |
|
|
||||||
black --check --line-length=120 django-stubs/
|
|
||||||
|
|
||||||
# - name: "Typecheck Django test suite"
|
|
||||||
# python: 3.7
|
|
||||||
# script: |
|
|
||||||
# xonsh ./scripts/typecheck_django_tests.xsh
|
|
||||||
|
|
||||||
before_install: |
|
|
||||||
# Upgrade pip, setuptools, and wheel
|
|
||||||
pip install -U pip setuptools wheel xonsh
|
|
||||||
|
|
||||||
install: |
|
|
||||||
pip install -r ./dev-requirements.txt
|
|
||||||
112
CONTRIBUTING.md
Normal file
112
CONTRIBUTING.md
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
# Contribution Guide
|
||||||
|
|
||||||
|
This project is open source and community driven. As such we encourage code contributions of all kinds. Some areas you can contribute in:
|
||||||
|
|
||||||
|
1. Improve the stubs
|
||||||
|
2. Sync stubs with the latest version of Django
|
||||||
|
3. Improve plugin code and extend its capabilities
|
||||||
|
4. Write tests
|
||||||
|
5. Update dependencies
|
||||||
|
|
||||||
|
## Tutorials
|
||||||
|
|
||||||
|
If you want to start working on this project, you will need to get familiar with python typings.
|
||||||
|
The Mypy documentation offers an excellent resource for this, as well as the python official documentation:
|
||||||
|
|
||||||
|
- [Mypy typing documentation](https://mypy.readthedocs.io/en/stable/#overview-type-system-reference)
|
||||||
|
- [Python official typing documentation](https://docs.python.org/3/library/typing.html)
|
||||||
|
- [Typing in Python](https://inventwithpython.com/blog/2019/11/24/type-hints-for-busy-python-programmers/) article
|
||||||
|
|
||||||
|
Additionally, the following resources might be useful:
|
||||||
|
|
||||||
|
- [How to write custom mypy plugins](https://mypy.readthedocs.io/en/stable/extending_mypy.html)
|
||||||
|
- [Typechecking Django and DRF](https://sobolevn.me/2019/08/typechecking-django-and-drf) guide
|
||||||
|
- [Testing mypy stubs, plugins, and types](https://sobolevn.me/2019/08/testing-mypy-types) guide
|
||||||
|
- [Awesome Python Typing](https://github.com/typeddjango/awesome-python-typing) list
|
||||||
|
|
||||||
|
## Dev setup
|
||||||
|
|
||||||
|
### Repository Setup
|
||||||
|
|
||||||
|
As a first step you will need to fork this repository and clone your fork locally.
|
||||||
|
In order to be able to continously sync your fork with the origin repository's master branch, you will need to set up an upstream master. To do so follow this [official github guide](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/syncing-a-fork).
|
||||||
|
|
||||||
|
### Dependency Setup
|
||||||
|
|
||||||
|
After your repository is setup you will then need to create and activate a git ignored virtual env, e.g.:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
Then install the dev requirements:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -r ./dev-requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, install the pre-commit hooks:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pre-commit install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testing and Linting
|
||||||
|
|
||||||
|
We use `mypy`, `pytest`, `flake8`, and `black` for quality control. All tools except pytest are executed using pre-commit when you make a commit.
|
||||||
|
To ensure there are not formatting or typing issues in the entire repository you can run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pre-commit run --all-files
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: This command will not only lint but also modify files - so make sure to commit whatever changes you've made before hand.
|
||||||
|
You can also run pre-commit per file or for a specific path, simply replace "--all-files" with a target (see [this guide](https://codeburst.io/tool-your-django-project-pre-commit-hooks-e1799d84551f) for more info).
|
||||||
|
|
||||||
|
To execute the unit tests, simply run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pytest
|
||||||
|
```
|
||||||
|
|
||||||
|
We also test the stubs against the Django's own test suite. This is done in CI but you can also do this locally.
|
||||||
|
To execute the script run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python ./scripts/typecheck_tests.py --django_version 3.0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Generating Stubs using Stubgen
|
||||||
|
|
||||||
|
The stubs are based on auto-generated code created by Mypy's stubgen tool (see: [the stubgen docs](https://mypy.readthedocs.io/en/stable/stubgen.html)).
|
||||||
|
To make life easier we have a helper script that auto generates these stubs. To use it you can run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python ./scripts/stubgen-django.py --django_version 3.1
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also pass an optional commit hash as a second kwarg to checkout a specific commit, e.g.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python ./scripts/stubgen-django.py --django_version 3.1 --commit_sha <commit_sha>
|
||||||
|
```
|
||||||
|
|
||||||
|
The output for this is a gitignored folder called "stubgen" in the repo's root.
|
||||||
|
|
||||||
|
## Submission Guidelines
|
||||||
|
|
||||||
|
The workflow for contributions is fairly simple:
|
||||||
|
|
||||||
|
1. fork and setup the repository as in the previous step.
|
||||||
|
2. create a local branch.
|
||||||
|
3. make whatever changes you want to contribute.
|
||||||
|
4. ensure your contribution does not introduce linting issues or breaks the tests by linting and testing the code.
|
||||||
|
5. make a pull request with an adequate description.
|
||||||
|
|
||||||
|
## A Note About Generics
|
||||||
|
|
||||||
|
As Django uses a lot of the more dynamic features of Python (i.e. metaobjects), statically typing it requires heavy use of generics. Unfortunately, the syntax for generics is also valid python syntax. For instance, the statement `class SomeClass(SuperType[int])` implicitly translates to `class SomeClass(SuperType.__class_getitem__(int))`. If `SuperType` doesn't define the `__class_getitem__` method, this causes a runtime error, even if the code typechecks.
|
||||||
|
|
||||||
|
When adding a new generic class, or changing an existing class to use generics, run a quick test to see if it causes a runtime error. If it does, please add the new generic class to the `_need_generic` list in the [django_stubs_ext monkeypatch function](https://github.com/typeddjango/django-stubs/tree/master/django_stubs_ext/django_stubs_ext/monkeypatch.py)
|
||||||
25
LICENSE.txt
25
LICENSE.txt
@@ -1,27 +1,8 @@
|
|||||||
Copyright (c) Maxim Kurnikov.
|
Copyright (c) Maxim Kurnikov.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice,
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. Neither the name of Django nor the names of its contributors may be used
|
|
||||||
to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|||||||
182
README.md
182
README.md
@@ -1,28 +1,190 @@
|
|||||||
<img src="http://mypy-lang.org/static/mypy_light.svg" alt="mypy logo" width="300px"/>
|
<img src="http://mypy-lang.org/static/mypy_light.svg" alt="mypy logo" width="300px"/>
|
||||||
|
|
||||||
# pep484 stubs for Django framework
|
# pep484 stubs for Django
|
||||||
|
|
||||||
[](https://travis-ci.org/mkurnikov/django-stubs)
|
[](https://github.com/typeddjango/django-stubs/actions?query=workflow%3Atest)
|
||||||
[](http://mypy-lang.org/)
|
[](http://mypy-lang.org/)
|
||||||
|
[](https://gitter.im/mypy-django/Lobby)
|
||||||
|
|
||||||
|
|
||||||
|
This package contains [type stubs](https://www.python.org/dev/peps/pep-0561/) and a custom mypy plugin to provide more precise static types and type inference for Django framework. Django uses some Python "magic" that makes having precise types for some code patterns problematic. This is why we need this project. The final goal is to be able to get precise types for most common patterns.
|
||||||
|
|
||||||
This package contains type stubs and mypy plugin to provide more precise static types and type inference for Django framework. Django uses some Python "magic" that makes having precise types for some code patterns problematic. This is why we need to accompany the stubs with mypy plugins. The final goal is to be able to get precise types for most common patterns.
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```
|
```bash
|
||||||
git clone https://github.com/mkurnikov/django-stubs.git
|
pip install django-stubs
|
||||||
cd django-stubs
|
|
||||||
pip install -U .
|
|
||||||
```
|
```
|
||||||
|
|
||||||
To make mypy aware of the plugin, you need to add
|
To make mypy aware of the plugin, you need to add
|
||||||
|
|
||||||
```
|
```ini
|
||||||
[mypy]
|
[mypy]
|
||||||
plugins =
|
plugins =
|
||||||
mypy_django_plugin.main
|
mypy_django_plugin.main
|
||||||
|
|
||||||
|
[mypy.plugins.django-stubs]
|
||||||
|
django_settings_module = "myproject.settings"
|
||||||
```
|
```
|
||||||
|
|
||||||
in your `mypy.ini` file.
|
in your `mypy.ini` or `setup.cfg` [file](https://mypy.readthedocs.io/en/latest/config_file.html).
|
||||||
|
|
||||||
Also, it uses value of `DJANGO_SETTINGS_MODULE` from the environment, so set it before execution, otherwise some features will not work.
|
Two things happeining here:
|
||||||
|
|
||||||
|
1. We need to explicitly list our plugin to be loaded by `mypy`
|
||||||
|
2. Our plugin also requires `django` settings module (what you put into `DJANGO_SETTINGS_MODULE` variable) to be specified
|
||||||
|
|
||||||
|
This fully working [typed boilerplate](https://github.com/wemake-services/wemake-django-template) can serve you as an example.
|
||||||
|
|
||||||
|
## Version compatibility
|
||||||
|
|
||||||
|
We rely on different `django` and `mypy` versions:
|
||||||
|
|
||||||
|
| django-stubs | mypy version | django version | python version
|
||||||
|
| ------------ | ---- | ---- | ---- |
|
||||||
|
| 1.7.0 | 0.790 | 2.2.x \|\| 3.x | ^3.6
|
||||||
|
| 1.6.0 | 0.780 | 2.2.x \|\| 3.x | ^3.6
|
||||||
|
| 1.5.0 | 0.770 | 2.2.x \|\| 3.x | ^3.6
|
||||||
|
| 1.4.0 | 0.760 | 2.2.x \|\| 3.x | ^3.6
|
||||||
|
| 1.3.0 | 0.750 | 2.2.x \|\| 3.x | ^3.6
|
||||||
|
| 1.2.0 | 0.730 | 2.2.x | ^3.6
|
||||||
|
| 1.1.0 | 0.720 | 2.2.x | ^3.6
|
||||||
|
| 0.12.x | old semantic analyzer (<0.711), dmypy support | 2.1.x | ^3.6
|
||||||
|
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### Is this an official Django project?
|
||||||
|
|
||||||
|
No, it is not. We are independent from Django at the moment.
|
||||||
|
There's a [proposal](https://github.com/django/deps/pull/65) to merge our project into the Django itself.
|
||||||
|
You can show your support by liking the PR.
|
||||||
|
|
||||||
|
### Is it safe to use this in production?
|
||||||
|
|
||||||
|
Yes, it is! This project does not affect your runtime at all.
|
||||||
|
It only affects `mypy` type checking process.
|
||||||
|
|
||||||
|
But, it does not make any sense to use this project without `mypy`.
|
||||||
|
|
||||||
|
### mypy crashes when I run it with this plugin installed
|
||||||
|
|
||||||
|
Current implementation uses Django runtime to extract models information, so it will crash, if your installed apps or `models.py` is not correct. For this same reason, you cannot use `reveal_type` inside global scope of any Python file that will be executed for `django.setup()`.
|
||||||
|
|
||||||
|
In other words, if your `manage.py runserver` crashes, mypy will crash too.
|
||||||
|
You can also run `mypy` with [`--tb`](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-show-traceback)
|
||||||
|
option to get extra information about the error.
|
||||||
|
|
||||||
|
### I cannot use QuerySet or Manager with type annotations
|
||||||
|
|
||||||
|
You can get a `TypeError: 'type' object is not subscriptable`
|
||||||
|
when you will try to use `QuerySet[MyModel]`, `Manager[MyModel]` or some other Django-based Generic types.
|
||||||
|
|
||||||
|
This happens because these Django classes do not support [`__class_getitem__`](https://www.python.org/dev/peps/pep-0560/#class-getitem) magic method in runtime.
|
||||||
|
|
||||||
|
1. You can go with our [`django_stubs_ext`](https://github.com/typeddjango/django-stubs/tree/master/django_stubs_ext) helper, that patches all the types we use as Generic in django.
|
||||||
|
|
||||||
|
Install it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install django-stubs-ext # as a production dependency
|
||||||
|
```
|
||||||
|
|
||||||
|
And then place in your top-level settings:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import django_stubs_ext
|
||||||
|
|
||||||
|
django_stubs_ext.monkeypatch()
|
||||||
|
```
|
||||||
|
|
||||||
|
2. You can use strings instead: `'QuerySet[MyModel]'` and `'Manager[MyModel]'`, this way it will work as a type for `mypy` and as a regular `str` in runtime.
|
||||||
|
|
||||||
|
### How can I create a HttpRequest that's guaranteed to have an authenticated user?
|
||||||
|
|
||||||
|
Django's built in `HttpRequest` has the attribute `user` that resolves to the type
|
||||||
|
```python
|
||||||
|
Union[User, AnonymousUser]
|
||||||
|
```
|
||||||
|
where `User` is the user model specified by the `AUTH_USER_MODEL` setting.
|
||||||
|
|
||||||
|
If you want a `HttpRequest` that you can type-annotate with where you know that the user is authenticated you can subclass the normal `HttpRequest` class like so:
|
||||||
|
```python
|
||||||
|
from django.http import HttpRequest
|
||||||
|
from my_user_app.models import MyUser
|
||||||
|
|
||||||
|
class AuthenticatedHttpRequest(HttpRequest):
|
||||||
|
user: MyUser
|
||||||
|
```
|
||||||
|
|
||||||
|
And then use `AuthenticatedHttpRequest` instead of the standard `HttpRequest` for when you know that the user is authenticated. For example in views using the `@login_required` decorator.
|
||||||
|
|
||||||
|
|
||||||
|
### My QuerySet methods are returning Any rather than my Model
|
||||||
|
|
||||||
|
`QuerySet.as_manager()` is not currently supported.
|
||||||
|
|
||||||
|
If you are using `MyQuerySet.as_manager()`, then your `Manager`/`QuerySet` methods will all not be linked to your model.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class MyModelQuerySet(models.QuerySet):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class MyModel(models.Model):
|
||||||
|
bar = models.IntegerField()
|
||||||
|
objects = MyModelQuerySet.as_manager()
|
||||||
|
|
||||||
|
def use_my_model():
|
||||||
|
foo = MyModel.objects.get(id=1) # This is `Any` but it should be `MyModel`
|
||||||
|
return foo.xyz # No error, but there should be
|
||||||
|
```
|
||||||
|
|
||||||
|
There is a workaround: use `Manager.from_queryset` instead.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class MyModelQuerySet(models.QuerySet):
|
||||||
|
pass
|
||||||
|
|
||||||
|
MyModelManager = models.Manager.from_queryset(MyModelQuerySet)
|
||||||
|
|
||||||
|
class MyModel(models.Model):
|
||||||
|
bar = models.IntegerField()
|
||||||
|
objects = MyModelManager()
|
||||||
|
|
||||||
|
def use_my_model():
|
||||||
|
foo = MyModel.objects.get(id=1)
|
||||||
|
return foo.xyz # Gives an error
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Related projects
|
||||||
|
|
||||||
|
- [`awesome-python-typing`](https://github.com/typeddjango/awesome-python-typing) - Awesome list of all typing-related things in Python.
|
||||||
|
- [`djangorestframework-stubs`](https://github.com/typeddjango/djangorestframework-stubs) - Stubs for Django REST Framework.
|
||||||
|
- [`pytest-mypy-plugins`](https://github.com/typeddjango/pytest-mypy-plugins) - `pytest` plugin that we use for testing `mypy` stubs and plugins.
|
||||||
|
- [`wemake-django-template`](https://github.com/wemake-services/wemake-django-template) - Create new typed Django projects in seconds.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## To get help
|
||||||
|
|
||||||
|
We have Gitter here: <https://gitter.im/mypy-django/Lobby>
|
||||||
|
If you think you have more generic typing issue, please refer to <https://github.com/python/mypy> and their Gitter.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
This project is open source and community driven. As such we encourage contributions big and small. You can contribute by doing any of the following:
|
||||||
|
|
||||||
|
1. Contribute code (e.g. improve stubs, add plugin capabilities, write tests etc) - to do so please follow the [contribution guide](./CONTRIBUTING.md).
|
||||||
|
2. Assist in code reviews and discussions in issues.
|
||||||
|
3. Identify bugs and issues and report these
|
||||||
|
|
||||||
|
You can always also reach out in gitter to discuss your contributions!
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
black
|
wheel
|
||||||
-e git+https://github.com/mkurnikov/pytest-mypy-plugins.git#egg=pytest-mypy-plugins
|
mypy==0.790
|
||||||
|
requests==2.24.0
|
||||||
|
coreapi==2.3.3
|
||||||
|
typing-extensions==3.7.4.3
|
||||||
|
gitpython==3.1.9
|
||||||
|
pre-commit==2.7.1
|
||||||
|
pytest==6.1.1
|
||||||
|
pytest-mypy-plugins==1.6.1
|
||||||
|
psycopg2-binary
|
||||||
|
-e ./django_stubs_ext
|
||||||
-e .
|
-e .
|
||||||
|
|||||||
1
django-sources
Submodule
1
django-sources
Submodule
Submodule django-sources added at aa28213eb5
@@ -1,5 +1,12 @@
|
|||||||
from typing import Any
|
from typing import Any, NamedTuple
|
||||||
|
from .utils.version import get_version as get_version
|
||||||
|
|
||||||
VERSION: Any
|
VERSION: Any
|
||||||
|
__version__: str
|
||||||
|
|
||||||
def setup(set_prefix: bool = ...) -> None: ...
|
def setup(set_prefix: bool = ...) -> None: ...
|
||||||
|
|
||||||
|
# Used by mypy_django_plugin when returning a QuerySet row that is a NamedTuple where the field names are unknown
|
||||||
|
class _NamedTupleAnyAttr(NamedTuple):
|
||||||
|
def __getattr__(self, item: str) -> Any: ...
|
||||||
|
def __setattr__(self, item: str, value: Any) -> None: ...
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
from typing import Any, Iterator, Type
|
from typing import Any, Iterator, Type, Optional, Dict
|
||||||
|
|
||||||
|
from django.apps.registry import Apps
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
|
|
||||||
MODELS_MODULE_NAME: str
|
MODELS_MODULE_NAME: str
|
||||||
|
|
||||||
class AppConfig:
|
class AppConfig:
|
||||||
name: str = ...
|
name: str = ...
|
||||||
module: Any = ...
|
module: Optional[Any] = ...
|
||||||
apps: None = ...
|
apps: Optional[Apps] = ...
|
||||||
label: str = ...
|
label: str = ...
|
||||||
verbose_name: str = ...
|
verbose_name: str = ...
|
||||||
path: str = ...
|
path: str = ...
|
||||||
models_module: None = ...
|
models_module: Optional[str] = ...
|
||||||
models: None = ...
|
models: Dict[str, Type[Model]] = ...
|
||||||
def __init__(self, app_name: str, app_module: None) -> None: ...
|
def __init__(self, app_name: str, app_module: Optional[Any]) -> None: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, entry: str) -> AppConfig: ...
|
def create(cls, entry: str) -> AppConfig: ...
|
||||||
def get_model(self, model_name: str, require_ready: bool = ...) -> Type[Model]: ...
|
def get_model(self, model_name: str, require_ready: bool = ...) -> Type[Model]: ...
|
||||||
|
|||||||
@@ -1,35 +1,37 @@
|
|||||||
import collections
|
import threading
|
||||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union, Iterable
|
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Type, Union
|
||||||
|
|
||||||
from django.db.migrations.state import AppConfigStub
|
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
|
|
||||||
from .config import AppConfig
|
from .config import AppConfig
|
||||||
|
|
||||||
class Apps:
|
class Apps:
|
||||||
all_models: collections.defaultdict = ...
|
all_models: Dict[str, Dict[str, Type[Model]]] = ...
|
||||||
app_configs: collections.OrderedDict = ...
|
app_configs: Dict[str, AppConfig] = ...
|
||||||
stored_app_configs: List[Any] = ...
|
stored_app_configs: List[Any] = ...
|
||||||
apps_ready: bool = ...
|
apps_ready: bool = ...
|
||||||
|
ready_event: threading.Event = ...
|
||||||
loading: bool = ...
|
loading: bool = ...
|
||||||
def __init__(self, installed_apps: Optional[Union[List[AppConfigStub], List[str], Tuple]] = ...) -> None: ...
|
_pending_operations: Dict[Tuple[str, str], List]
|
||||||
models_ready: bool = ...
|
models_ready: bool = ...
|
||||||
ready: bool = ...
|
ready: bool = ...
|
||||||
def populate(self, installed_apps: Union[List[AppConfigStub], List[str], Tuple] = ...) -> None: ...
|
def __init__(self, installed_apps: Optional[Iterable[Union[AppConfig, str]]] = ...) -> None: ...
|
||||||
|
def populate(self, installed_apps: Iterable[Union[AppConfig, str]] = ...) -> None: ...
|
||||||
def check_apps_ready(self) -> None: ...
|
def check_apps_ready(self) -> None: ...
|
||||||
def check_models_ready(self) -> None: ...
|
def check_models_ready(self) -> None: ...
|
||||||
def get_app_configs(self) -> Iterable[AppConfig]: ...
|
def get_app_configs(self) -> Iterable[AppConfig]: ...
|
||||||
def get_app_config(self, app_label: str) -> AppConfig: ...
|
def get_app_config(self, app_label: str) -> AppConfig: ...
|
||||||
|
# it's not possible to support it in plugin properly now
|
||||||
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> List[Type[Model]]: ...
|
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> List[Type[Model]]: ...
|
||||||
def get_model(self, app_label: str, model_name: Optional[str] = ..., require_ready: bool = ...) -> Type[Model]: ...
|
def get_model(self, app_label: str, model_name: Optional[str] = ..., require_ready: bool = ...) -> Type[Any]: ...
|
||||||
def register_model(self, app_label: str, model: Type[Model]) -> None: ...
|
def register_model(self, app_label: str, model: Type[Model]) -> None: ...
|
||||||
def is_installed(self, app_name: str) -> bool: ...
|
def is_installed(self, app_name: str) -> bool: ...
|
||||||
def get_containing_app_config(self, object_name: str) -> Optional[AppConfig]: ...
|
def get_containing_app_config(self, object_name: str) -> Optional[AppConfig]: ...
|
||||||
def get_registered_model(self, app_label: str, model_name: str) -> Type[Model]: ...
|
def get_registered_model(self, app_label: str, model_name: str) -> Type[Model]: ...
|
||||||
def get_swappable_settings_name(self, to_string: str) -> Optional[str]: ...
|
def get_swappable_settings_name(self, to_string: str) -> Optional[str]: ...
|
||||||
def set_available_apps(self, available: List[str]) -> None: ...
|
def set_available_apps(self, available: Iterable[str]) -> None: ...
|
||||||
def unset_available_apps(self) -> None: ...
|
def unset_available_apps(self) -> None: ...
|
||||||
def set_installed_apps(self, installed: Union[List[str], Tuple[str]]) -> None: ...
|
def set_installed_apps(self, installed: Iterable[str]) -> None: ...
|
||||||
def unset_installed_apps(self) -> None: ...
|
def unset_installed_apps(self) -> None: ...
|
||||||
def clear_cache(self) -> None: ...
|
def clear_cache(self) -> None: ...
|
||||||
def lazy_model_operation(self, function: Callable, *model_keys: Any) -> None: ...
|
def lazy_model_operation(self, function: Callable, *model_keys: Any) -> None: ...
|
||||||
|
|||||||
@@ -2,8 +2,16 @@ from typing import Any
|
|||||||
|
|
||||||
from django.utils.functional import LazyObject
|
from django.utils.functional import LazyObject
|
||||||
|
|
||||||
|
# explicit dependency on standard settings to make it loaded
|
||||||
|
from . import global_settings
|
||||||
|
|
||||||
|
ENVIRONMENT_VARIABLE: str = ...
|
||||||
|
DEFAULT_CONTENT_TYPE_DEPRECATED_MSG: str = ...
|
||||||
|
FILE_CHARSET_DEPRECATED_MSG: str = ...
|
||||||
|
|
||||||
# required for plugin to be able to distinguish this specific instance of LazySettings from others
|
# required for plugin to be able to distinguish this specific instance of LazySettings from others
|
||||||
class _DjangoConfLazyObject(LazyObject): ...
|
class _DjangoConfLazyObject(LazyObject):
|
||||||
|
def __getattr__(self, item: Any) -> Any: ...
|
||||||
|
|
||||||
class LazySettings(_DjangoConfLazyObject):
|
class LazySettings(_DjangoConfLazyObject):
|
||||||
configured: bool
|
configured: bool
|
||||||
@@ -11,5 +19,11 @@ class LazySettings(_DjangoConfLazyObject):
|
|||||||
|
|
||||||
settings: LazySettings = ...
|
settings: LazySettings = ...
|
||||||
|
|
||||||
class Settings: ...
|
class Settings:
|
||||||
|
def __init__(self, settings_module: str): ...
|
||||||
|
def is_overridden(self, setting: str) -> bool: ...
|
||||||
|
|
||||||
class UserSettingsHolder: ...
|
class UserSettingsHolder: ...
|
||||||
|
|
||||||
|
class SettingsReference(str):
|
||||||
|
def __init__(self, value: str, setting_name: str) -> None: ...
|
||||||
|
|||||||
504
django-stubs/conf/global_settings.pyi
Normal file
504
django-stubs/conf/global_settings.pyi
Normal file
@@ -0,0 +1,504 @@
|
|||||||
|
"""
|
||||||
|
Default Django settings. Override these with settings in the module pointed to
|
||||||
|
by the DJANGO_SETTINGS_MODULE environment variable.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# This is defined here as a do-nothing function because we can't import
|
||||||
|
# django.utils.translation -- that module depends on the settings.
|
||||||
|
from typing import Any, Dict, List, Optional, Pattern, Protocol, Sequence, Tuple, Union
|
||||||
|
|
||||||
|
####################
|
||||||
|
# CORE #
|
||||||
|
####################
|
||||||
|
DEBUG: bool = ...
|
||||||
|
|
||||||
|
# Whether the framework should propagate raw exceptions rather than catching
|
||||||
|
# them. This is useful under some testing situations and should never be used
|
||||||
|
# on a live site.
|
||||||
|
DEBUG_PROPAGATE_EXCEPTIONS: bool = ...
|
||||||
|
|
||||||
|
# People who get code error notifications.
|
||||||
|
# In the format [('Full Name', 'email@example.com'), ('Full Name', 'anotheremail@example.com')]
|
||||||
|
ADMINS: List[Tuple[str, str]] = ...
|
||||||
|
|
||||||
|
# List of IP addresses, as strings, that:
|
||||||
|
# * See debug comments, when DEBUG is true
|
||||||
|
# * Receive x-headers
|
||||||
|
INTERNAL_IPS: List[str] = ...
|
||||||
|
|
||||||
|
# Hosts/domain names that are valid for this site.
|
||||||
|
# "*" matches anything, ".example.com" matches example.com and all subdomains
|
||||||
|
ALLOWED_HOSTS: List[str] = ...
|
||||||
|
|
||||||
|
# Local time zone for this installation. All choices can be found here:
|
||||||
|
# https://en.wikipedia.org/wiki/List_of_tz_zones_by_name (although not all
|
||||||
|
# systems may support all possibilities). When USE_TZ is True, this is
|
||||||
|
# interpreted as the default user time zone.
|
||||||
|
TIME_ZONE: str = ...
|
||||||
|
|
||||||
|
# If you set this to True, Django will use timezone-aware datetimes.
|
||||||
|
USE_TZ: bool = ...
|
||||||
|
|
||||||
|
# Language code for this installation. All choices can be found here:
|
||||||
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||||
|
LANGUAGE_CODE: str = ...
|
||||||
|
|
||||||
|
# Languages we provide translations for, out of the box.
|
||||||
|
LANGUAGES: List[Tuple[str, str]] = ...
|
||||||
|
|
||||||
|
# Languages using BiDi (right-to-left) layout
|
||||||
|
LANGUAGES_BIDI: List[str] = ...
|
||||||
|
|
||||||
|
# If you set this to False, Django will make some optimizations so as not
|
||||||
|
# to load the internationalization machinery.
|
||||||
|
USE_I18N: bool = ...
|
||||||
|
LOCALE_PATHS: List[str] = ...
|
||||||
|
|
||||||
|
# Settings for language cookie
|
||||||
|
LANGUAGE_COOKIE_NAME: str = ...
|
||||||
|
LANGUAGE_COOKIE_AGE: Optional[int] = ...
|
||||||
|
LANGUAGE_COOKIE_DOMAIN: Optional[str] = ...
|
||||||
|
LANGUAGE_COOKIE_PATH: str = ...
|
||||||
|
|
||||||
|
# If you set this to True, Django will format dates, numbers and calendars
|
||||||
|
# according to user current locale.
|
||||||
|
USE_L10N: bool = ...
|
||||||
|
|
||||||
|
# Not-necessarily-technical managers of the site. They get broken link
|
||||||
|
# notifications and other various emails.
|
||||||
|
MANAGERS = ADMINS
|
||||||
|
|
||||||
|
# Default content type and charset to use for all HttpResponse objects, if a
|
||||||
|
# MIME type isn't manually specified. These are used to construct the
|
||||||
|
# Content-Type header.
|
||||||
|
DEFAULT_CONTENT_TYPE: str = ...
|
||||||
|
DEFAULT_CHARSET: str = ...
|
||||||
|
|
||||||
|
# Encoding of files read from disk (template and initial SQL files).
|
||||||
|
FILE_CHARSET: str = ...
|
||||||
|
|
||||||
|
# Email address that error messages come from.
|
||||||
|
SERVER_EMAIL: str = ...
|
||||||
|
|
||||||
|
# Database connection info. If left empty, will default to the dummy backend.
|
||||||
|
DATABASES: Dict[str, Dict[str, Any]] = ...
|
||||||
|
|
||||||
|
# Classes used to implement DB routing behavior.
|
||||||
|
class Router(Protocol):
|
||||||
|
def allow_migrate(self, db, app_label, **hints): ...
|
||||||
|
|
||||||
|
DATABASE_ROUTERS: List[Union[str, Router]] = ...
|
||||||
|
|
||||||
|
# The email backend to use. For possible shortcuts see django.core.mail.
|
||||||
|
# The default is to use the SMTP backend.
|
||||||
|
# Third-party backends can be specified by providing a Python path
|
||||||
|
# to a module that defines an EmailBackend class.
|
||||||
|
EMAIL_BACKEND: str = ...
|
||||||
|
|
||||||
|
# Host for sending email.
|
||||||
|
EMAIL_HOST: str = ...
|
||||||
|
|
||||||
|
# Port for sending email.
|
||||||
|
EMAIL_PORT: int = ...
|
||||||
|
|
||||||
|
# Whether to send SMTP 'Date' header in the local time zone or in UTC.
|
||||||
|
EMAIL_USE_LOCALTIME: bool = ...
|
||||||
|
|
||||||
|
# Optional SMTP authentication information for EMAIL_HOST.
|
||||||
|
EMAIL_HOST_USER: str = ...
|
||||||
|
EMAIL_HOST_PASSWORD: str = ...
|
||||||
|
EMAIL_USE_TLS: bool = ...
|
||||||
|
EMAIL_USE_SSL: bool = ...
|
||||||
|
EMAIL_SSL_CERTFILE: Optional[str] = ...
|
||||||
|
EMAIL_SSL_KEYFILE: Optional[str] = ...
|
||||||
|
EMAIL_TIMEOUT: Optional[int] = ...
|
||||||
|
|
||||||
|
# List of strings representing installed apps.
|
||||||
|
INSTALLED_APPS: List[str] = ...
|
||||||
|
|
||||||
|
TEMPLATES: List[Dict[str, Any]] = ...
|
||||||
|
|
||||||
|
# Default form rendering class.
|
||||||
|
FORM_RENDERER: str = ...
|
||||||
|
|
||||||
|
# Default email address to use for various automated correspondence from
|
||||||
|
# the site managers.
|
||||||
|
DEFAULT_FROM_EMAIL: str = ...
|
||||||
|
|
||||||
|
# Subject-line prefix for email messages send with django.core.mail.mail_admins
|
||||||
|
# or ...mail_managers. Make sure to include the trailing space.
|
||||||
|
EMAIL_SUBJECT_PREFIX: str = ...
|
||||||
|
|
||||||
|
# Whether to append trailing slashes to URLs.
|
||||||
|
APPEND_SLASH: bool = ...
|
||||||
|
|
||||||
|
# Whether to prepend the "www." subdomain to URLs that don't have it.
|
||||||
|
PREPEND_WWW: bool = ...
|
||||||
|
|
||||||
|
# Override the server-derived value of SCRIPT_NAME
|
||||||
|
FORCE_SCRIPT_NAME = None
|
||||||
|
|
||||||
|
# List of compiled regular expression objects representing User-Agent strings
|
||||||
|
# that are not allowed to visit any page, systemwide. Use this for bad
|
||||||
|
# robots/crawlers. Here are a few examples:
|
||||||
|
# import re
|
||||||
|
# DISALLOWED_USER_AGENTS = [
|
||||||
|
# re.compile(r'^NaverBot.*'),
|
||||||
|
# re.compile(r'^EmailSiphon.*'),
|
||||||
|
# re.compile(r'^SiteSucker.*'),
|
||||||
|
# re.compile(r'^sohu-search'),
|
||||||
|
# ]
|
||||||
|
DISALLOWED_USER_AGENTS: List[Pattern] = ...
|
||||||
|
|
||||||
|
ABSOLUTE_URL_OVERRIDES: Dict[str, Any] = ...
|
||||||
|
|
||||||
|
# List of compiled regular expression objects representing URLs that need not
|
||||||
|
# be reported by BrokenLinkEmailsMiddleware. Here are a few examples:
|
||||||
|
# import re
|
||||||
|
# IGNORABLE_404_URLS = [
|
||||||
|
# re.compile(r'^/apple-touch-icon.*\.png$'),
|
||||||
|
# re.compile(r'^/favicon.ico$'),
|
||||||
|
# re.compile(r'^/robots.txt$'),
|
||||||
|
# re.compile(r'^/phpmyadmin/'),
|
||||||
|
# re.compile(r'\.(cgi|php|pl)$'),
|
||||||
|
# ]
|
||||||
|
IGNORABLE_404_URLS: List[Pattern] = ...
|
||||||
|
|
||||||
|
# A secret key for this particular Django installation. Used in secret-key
|
||||||
|
# hashing algorithms. Set this in your settings, or Django will complain
|
||||||
|
# loudly.
|
||||||
|
SECRET_KEY: str = ...
|
||||||
|
|
||||||
|
# Default file storage mechanism that holds media.
|
||||||
|
DEFAULT_FILE_STORAGE: str = ...
|
||||||
|
|
||||||
|
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
||||||
|
# Example: "/var/www/example.com/media/"
|
||||||
|
MEDIA_ROOT: str = ...
|
||||||
|
|
||||||
|
# URL that handles the media served from MEDIA_ROOT.
|
||||||
|
# Examples: "http://example.com/media/", "http://media.example.com/"
|
||||||
|
MEDIA_URL: str = ...
|
||||||
|
|
||||||
|
# Absolute path to the directory static files should be collected to.
|
||||||
|
# Example: "/var/www/example.com/static/"
|
||||||
|
STATIC_ROOT: Optional[str] = ...
|
||||||
|
|
||||||
|
# URL that handles the static files served from STATIC_ROOT.
|
||||||
|
# Example: "http://example.com/static/", "http://static.example.com/"
|
||||||
|
STATIC_URL: Optional[str] = ...
|
||||||
|
|
||||||
|
# List of upload handler classes to be applied in order.
|
||||||
|
FILE_UPLOAD_HANDLERS: List[str] = ...
|
||||||
|
|
||||||
|
# Maximum size, in bytes, of a request before it will be streamed to the
|
||||||
|
# file system instead of into memory.
|
||||||
|
FILE_UPLOAD_MAX_MEMORY_SIZE: int = ... # i.e. 2.5 MB
|
||||||
|
|
||||||
|
# Maximum size in bytes of request data (excluding file uploads) that will be
|
||||||
|
# read before a SuspiciousOperation (RequestDataTooBig) is raised.
|
||||||
|
DATA_UPLOAD_MAX_MEMORY_SIZE: int = ... # i.e. 2.5 MB
|
||||||
|
|
||||||
|
# Maximum number of GET/POST parameters that will be read before a
|
||||||
|
# SuspiciousOperation (TooManyFieldsSent) is raised.
|
||||||
|
DATA_UPLOAD_MAX_NUMBER_FIELDS: int = ...
|
||||||
|
|
||||||
|
# Directory in which upload streamed files will be temporarily saved. A value of
|
||||||
|
# `None` will make Django use the operating system's default temporary directory
|
||||||
|
# (i.e. "/tmp" on *nix systems).
|
||||||
|
FILE_UPLOAD_TEMP_DIR: Optional[str] = ...
|
||||||
|
|
||||||
|
# The numeric mode to set newly-uploaded files to. The value should be a mode
|
||||||
|
# you'd pass directly to os.chmod; see https://docs.python.org/library/os.html#files-and-directories.
|
||||||
|
FILE_UPLOAD_PERMISSIONS = None
|
||||||
|
|
||||||
|
# The numeric mode to assign to newly-created directories, when uploading files.
|
||||||
|
# The value should be a mode as you'd pass to os.chmod;
|
||||||
|
# see https://docs.python.org/library/os.html#files-and-directories.
|
||||||
|
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
|
||||||
|
|
||||||
|
# Python module path where user will place custom format definition.
|
||||||
|
# The directory where this setting is pointing should contain subdirectories
|
||||||
|
# named as the locales, containing a formats.py file
|
||||||
|
# (i.e. "myproject.locale" for myproject/locale/en/formats.py etc. use)
|
||||||
|
FORMAT_MODULE_PATH: Optional[str] = ...
|
||||||
|
|
||||||
|
# Default formatting for date objects. See all available format strings here:
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||||
|
DATE_FORMAT: str = ...
|
||||||
|
|
||||||
|
# Default formatting for datetime objects. See all available format strings here:
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||||
|
DATETIME_FORMAT: str = ...
|
||||||
|
|
||||||
|
# Default formatting for time objects. See all available format strings here:
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||||
|
TIME_FORMAT: str = ...
|
||||||
|
|
||||||
|
# Default formatting for date objects when only the year and month are relevant.
|
||||||
|
# See all available format strings here:
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||||
|
YEAR_MONTH_FORMAT: str = ...
|
||||||
|
|
||||||
|
# Default formatting for date objects when only the month and day are relevant.
|
||||||
|
# See all available format strings here:
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||||
|
MONTH_DAY_FORMAT: str = ...
|
||||||
|
|
||||||
|
# Default short formatting for date objects. See all available format strings here:
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||||
|
SHORT_DATE_FORMAT: str = ...
|
||||||
|
|
||||||
|
# Default short formatting for datetime objects.
|
||||||
|
# See all available format strings here:
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||||
|
SHORT_DATETIME_FORMAT: str = ...
|
||||||
|
|
||||||
|
# Default formats to be used when parsing dates from input boxes, in order
|
||||||
|
# See all available format string here:
|
||||||
|
# https://docs.python.org/library/datetime.html#strftime-behavior
|
||||||
|
# * Note that these format strings are different from the ones to display dates
|
||||||
|
DATE_INPUT_FORMATS: List[str] = ...
|
||||||
|
|
||||||
|
# Default formats to be used when parsing times from input boxes, in order
|
||||||
|
# See all available format string here:
|
||||||
|
# https://docs.python.org/library/datetime.html#strftime-behavior
|
||||||
|
# * Note that these format strings are different from the ones to display dates
|
||||||
|
TIME_INPUT_FORMATS: List[str] = ... # '14:30:59' # '14:30:59.000200' # '14:30'
|
||||||
|
|
||||||
|
# Default formats to be used when parsing dates and times from input boxes,
|
||||||
|
# in order
|
||||||
|
# See all available format string here:
|
||||||
|
# https://docs.python.org/library/datetime.html#strftime-behavior
|
||||||
|
# * Note that these format strings are different from the ones to display dates
|
||||||
|
DATETIME_INPUT_FORMATS: List[str] = ...
|
||||||
|
|
||||||
|
# First day of week, to be used on calendars
|
||||||
|
# 0 means Sunday, 1 means Monday...
|
||||||
|
FIRST_DAY_OF_WEEK: int = ...
|
||||||
|
|
||||||
|
# Decimal separator symbol
|
||||||
|
DECIMAL_SEPARATOR: str = ...
|
||||||
|
|
||||||
|
# Boolean that sets whether to add thousand separator when formatting numbers
|
||||||
|
USE_THOUSAND_SEPARATOR: bool = ...
|
||||||
|
|
||||||
|
# Number of digits that will be together, when splitting them by
|
||||||
|
# THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands...
|
||||||
|
NUMBER_GROUPING: int = ...
|
||||||
|
|
||||||
|
# Thousand separator symbol
|
||||||
|
THOUSAND_SEPARATOR: str = ...
|
||||||
|
|
||||||
|
# The tablespaces to use for each model when not specified otherwise.
|
||||||
|
DEFAULT_TABLESPACE: str = ...
|
||||||
|
DEFAULT_INDEX_TABLESPACE: str = ...
|
||||||
|
|
||||||
|
# Default X-Frame-Options header value
|
||||||
|
X_FRAME_OPTIONS: str = ...
|
||||||
|
|
||||||
|
USE_X_FORWARDED_HOST: bool = ...
|
||||||
|
USE_X_FORWARDED_PORT: bool = ...
|
||||||
|
|
||||||
|
# The Python dotted path to the WSGI application that Django's internal server
|
||||||
|
# (runserver) will use. If `None`, the return value of
|
||||||
|
# 'django.core.wsgi.get_wsgi_application' is used, thus preserving the same
|
||||||
|
# behavior as previous versions of Django. Otherwise this should point to an
|
||||||
|
# actual WSGI application object.
|
||||||
|
WSGI_APPLICATION: Optional[str] = ...
|
||||||
|
|
||||||
|
# If your Django app is behind a proxy that sets a header to specify secure
|
||||||
|
# connections, AND that proxy ensures that user-submitted headers with the
|
||||||
|
# same name are ignored (so that people can't spoof it), set this value to
|
||||||
|
# a tuple of (header_name, header_value). For any requests that come in with
|
||||||
|
# that header/value, request.is_secure() will return True.
|
||||||
|
# WARNING! Only set this if you fully understand what you're doing. Otherwise,
|
||||||
|
# you may be opening yourself up to a security risk.
|
||||||
|
SECURE_PROXY_SSL_HEADER: Optional[Tuple[str, str]] = ...
|
||||||
|
|
||||||
|
##############
|
||||||
|
# MIDDLEWARE #
|
||||||
|
##############
|
||||||
|
|
||||||
|
# List of middleware to use. Order is important; in the request phase, these
|
||||||
|
# middleware will be applied in the order given, and in the response
|
||||||
|
# phase the middleware will be applied in reverse order.
|
||||||
|
MIDDLEWARE: List[str] = ...
|
||||||
|
|
||||||
|
############
|
||||||
|
# SESSIONS #
|
||||||
|
############
|
||||||
|
|
||||||
|
# Cache to store session data if using the cache session backend.
|
||||||
|
SESSION_CACHE_ALIAS = "default"
|
||||||
|
# Cookie name. This can be whatever you want.
|
||||||
|
SESSION_COOKIE_NAME = "sessionid"
|
||||||
|
# Age of cookie, in seconds (default: 2 weeks).
|
||||||
|
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2
|
||||||
|
# A string like "example.com", or None for standard domain cookie.
|
||||||
|
SESSION_COOKIE_DOMAIN: Optional[str] = ...
|
||||||
|
# Whether the session cookie should be secure (https:// only).
|
||||||
|
SESSION_COOKIE_SECURE = False
|
||||||
|
# The path of the session cookie.
|
||||||
|
SESSION_COOKIE_PATH = "/"
|
||||||
|
# Whether to use the non-RFC standard httpOnly flag (IE, FF3+, others)
|
||||||
|
SESSION_COOKIE_HTTPONLY = True
|
||||||
|
# Whether to set the flag restricting cookie leaks on cross-site requests.
|
||||||
|
# This can be 'Lax', 'Strict', or None to disable the flag.
|
||||||
|
SESSION_COOKIE_SAMESITE: Optional[str] = ...
|
||||||
|
# Whether to save the session data on every request.
|
||||||
|
SESSION_SAVE_EVERY_REQUEST = False
|
||||||
|
# Whether a user's session cookie expires when the Web browser is closed.
|
||||||
|
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
|
||||||
|
# The module to store session data
|
||||||
|
SESSION_ENGINE = "django.contrib.sessions.backends.db"
|
||||||
|
# Directory to store session files if using the file session module. If None,
|
||||||
|
# the backend will use a sensible default.
|
||||||
|
SESSION_FILE_PATH: Optional[str] = ...
|
||||||
|
# class to serialize session data
|
||||||
|
SESSION_SERIALIZER = "django.contrib.sessions.serializers.JSONSerializer"
|
||||||
|
|
||||||
|
#########
|
||||||
|
# CACHE #
|
||||||
|
#########
|
||||||
|
|
||||||
|
# The cache backends to use.
|
||||||
|
CACHES: Dict[str, Dict[str, Any]] = ...
|
||||||
|
CACHE_MIDDLEWARE_KEY_PREFIX = ""
|
||||||
|
CACHE_MIDDLEWARE_SECONDS = 600
|
||||||
|
CACHE_MIDDLEWARE_ALIAS = "default"
|
||||||
|
|
||||||
|
##################
|
||||||
|
# AUTHENTICATION #
|
||||||
|
##################
|
||||||
|
|
||||||
|
AUTH_USER_MODEL: str = ...
|
||||||
|
|
||||||
|
AUTHENTICATION_BACKENDS: Sequence[str] = ...
|
||||||
|
|
||||||
|
LOGIN_URL = "/accounts/login/"
|
||||||
|
|
||||||
|
LOGIN_REDIRECT_URL: str = ...
|
||||||
|
|
||||||
|
LOGOUT_REDIRECT_URL: Optional[str] = ...
|
||||||
|
|
||||||
|
# The number of days a password reset link is valid for
|
||||||
|
PASSWORD_RESET_TIMEOUT_DAYS = 3
|
||||||
|
|
||||||
|
# the first hasher in this list is the preferred algorithm. any
|
||||||
|
# password using different algorithms will be converted automatically
|
||||||
|
# upon login
|
||||||
|
PASSWORD_HASHERS: List[str] = ...
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS: List[Dict[str, str]] = ...
|
||||||
|
|
||||||
|
###########
|
||||||
|
# SIGNING #
|
||||||
|
###########
|
||||||
|
|
||||||
|
SIGNING_BACKEND = "django.core.signing.TimestampSigner"
|
||||||
|
|
||||||
|
########
|
||||||
|
# CSRF #
|
||||||
|
########
|
||||||
|
|
||||||
|
# Dotted path to callable to be used as view when a request is
|
||||||
|
# rejected by the CSRF middleware.
|
||||||
|
CSRF_FAILURE_VIEW = "django.views.csrf.csrf_failure"
|
||||||
|
|
||||||
|
# Settings for CSRF cookie.
|
||||||
|
CSRF_COOKIE_NAME = "csrftoken"
|
||||||
|
CSRF_COOKIE_AGE = 60 * 60 * 24 * 7 * 52
|
||||||
|
CSRF_COOKIE_DOMAIN = None
|
||||||
|
CSRF_COOKIE_PATH = "/"
|
||||||
|
CSRF_COOKIE_SECURE = False
|
||||||
|
CSRF_COOKIE_HTTPONLY = False
|
||||||
|
CSRF_COOKIE_SAMESITE: Optional[str] = ...
|
||||||
|
CSRF_HEADER_NAME = "HTTP_X_CSRFTOKEN"
|
||||||
|
CSRF_TRUSTED_ORIGINS: List[str] = ...
|
||||||
|
CSRF_USE_SESSIONS = False
|
||||||
|
|
||||||
|
############
|
||||||
|
# MESSAGES #
|
||||||
|
############
|
||||||
|
|
||||||
|
# Class to use as messages backend
|
||||||
|
MESSAGE_STORAGE = "django.contrib.messages.storage.fallback.FallbackStorage"
|
||||||
|
|
||||||
|
# Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within
|
||||||
|
# django.contrib.messages to avoid imports in this settings file.
|
||||||
|
|
||||||
|
###########
|
||||||
|
# LOGGING #
|
||||||
|
###########
|
||||||
|
|
||||||
|
# The callable to use to configure logging
|
||||||
|
LOGGING_CONFIG = "logging.config.dictConfig"
|
||||||
|
|
||||||
|
# Custom logging configuration.
|
||||||
|
LOGGING: Dict[str, Any] = ...
|
||||||
|
|
||||||
|
# Default exception reporter filter class used in case none has been
|
||||||
|
# specifically assigned to the HttpRequest instance.
|
||||||
|
DEFAULT_EXCEPTION_REPORTER_FILTER = "django.views.debug.SafeExceptionReporterFilter"
|
||||||
|
|
||||||
|
###########
|
||||||
|
# TESTING #
|
||||||
|
###########
|
||||||
|
|
||||||
|
# The name of the class to use to run the test suite
|
||||||
|
TEST_RUNNER = "django.test.runner.DiscoverRunner"
|
||||||
|
|
||||||
|
# Apps that don't need to be serialized at test database creation time
|
||||||
|
# (only apps with migrations are to start with)
|
||||||
|
TEST_NON_SERIALIZED_APPS: List[str] = ...
|
||||||
|
|
||||||
|
############
|
||||||
|
# FIXTURES #
|
||||||
|
############
|
||||||
|
|
||||||
|
# The list of directories to search for fixtures
|
||||||
|
FIXTURE_DIRS: List[str] = ...
|
||||||
|
|
||||||
|
###############
|
||||||
|
# STATICFILES #
|
||||||
|
###############
|
||||||
|
|
||||||
|
# A list of locations of additional static files
|
||||||
|
STATICFILES_DIRS: List[str] = ...
|
||||||
|
|
||||||
|
# The default file storage backend used during the build process
|
||||||
|
STATICFILES_STORAGE: str = ...
|
||||||
|
|
||||||
|
# List of finder classes that know how to find static files in
|
||||||
|
# various locations.
|
||||||
|
STATICFILES_FINDERS: List[str] = ...
|
||||||
|
|
||||||
|
##############
|
||||||
|
# MIGRATIONS #
|
||||||
|
##############
|
||||||
|
|
||||||
|
# Migration module overrides for apps, by app label.
|
||||||
|
MIGRATION_MODULES: Dict[str, str] = ...
|
||||||
|
|
||||||
|
#################
|
||||||
|
# SYSTEM CHECKS #
|
||||||
|
#################
|
||||||
|
|
||||||
|
# List of all issues generated by system checks that should be silenced. Light
|
||||||
|
# issues like warnings, infos or debugs will not generate a message. Silencing
|
||||||
|
# serious issues like errors and criticals does not result in hiding the
|
||||||
|
# message, but Django will not stop you from e.g. running server.
|
||||||
|
SILENCED_SYSTEM_CHECKS: List[str] = ...
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# SECURITY MIDDLEWARE #
|
||||||
|
#######################
|
||||||
|
SECURE_BROWSER_XSS_FILTER = False
|
||||||
|
SECURE_CONTENT_TYPE_NOSNIFF = False
|
||||||
|
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
|
||||||
|
SECURE_HSTS_PRELOAD = False
|
||||||
|
SECURE_HSTS_SECONDS = 0
|
||||||
|
SECURE_REDIRECT_EXEMPT: List[str] = ...
|
||||||
|
SECURE_SSL_HOST = None
|
||||||
|
SECURE_SSL_REDIRECT = False
|
||||||
3
django-stubs/conf/locale/__init__.pyi
Normal file
3
django-stubs/conf/locale/__init__.pyi
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from typing import Dict, Any
|
||||||
|
|
||||||
|
LANG_INFO: Dict[str, Any] = ...
|
||||||
@@ -1,20 +1,22 @@
|
|||||||
# Stubs for django.conf.urls (Python 3.5)
|
# Stubs for django.conf.urls (Python 3.5)
|
||||||
from typing import Any, Callable, Dict, List, Optional, overload, Tuple, Union
|
from typing import Any, Callable, Dict, List, Optional, overload, Tuple, Union
|
||||||
|
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse, HttpResponseBase
|
||||||
|
|
||||||
from django.urls import URLResolver, URLPattern
|
from django.urls import URLResolver, URLPattern
|
||||||
|
|
||||||
handler400 = ... # type: str
|
handler400: Union[str, Callable[..., HttpResponse]] = ...
|
||||||
handler403 = ... # type: str
|
handler403: Union[str, Callable[..., HttpResponse]] = ...
|
||||||
handler404 = ... # type: str
|
handler404: Union[str, Callable[..., HttpResponse]] = ...
|
||||||
handler500 = ... # type: str
|
handler500: Union[str, Callable[..., HttpResponse]] = ...
|
||||||
|
|
||||||
IncludedURLConf = Tuple[List[URLResolver], Optional[str], Optional[str]]
|
IncludedURLConf = Tuple[List[URLResolver], Optional[str], Optional[str]]
|
||||||
|
|
||||||
def include(arg: Any, namespace: str = ..., app_name: str = ...) -> IncludedURLConf: ...
|
def include(arg: Any, namespace: str = ..., app_name: str = ...) -> IncludedURLConf: ...
|
||||||
@overload
|
@overload
|
||||||
def url(regex: str, view: Callable[..., HttpResponse], kwargs: Dict[str, Any] = ..., name: str = ...) -> URLPattern: ...
|
def url(
|
||||||
|
regex: str, view: Callable[..., HttpResponseBase], kwargs: Dict[str, Any] = ..., name: str = ...
|
||||||
|
) -> URLPattern: ...
|
||||||
@overload
|
@overload
|
||||||
def url(regex: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ...) -> URLResolver: ...
|
def url(regex: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ...) -> URLResolver: ...
|
||||||
@overload
|
@overload
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from django.contrib.admin.decorators import register as register
|
from .decorators import register as register
|
||||||
from django.contrib.admin.filters import (
|
from .filters import (
|
||||||
AllValuesFieldListFilter as AllValuesFieldListFilter,
|
AllValuesFieldListFilter as AllValuesFieldListFilter,
|
||||||
BooleanFieldListFilter as BooleanFieldListFilter,
|
BooleanFieldListFilter as BooleanFieldListFilter,
|
||||||
ChoicesFieldListFilter as ChoicesFieldListFilter,
|
ChoicesFieldListFilter as ChoicesFieldListFilter,
|
||||||
@@ -10,14 +10,15 @@ from django.contrib.admin.filters import (
|
|||||||
RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter,
|
RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter,
|
||||||
SimpleListFilter as SimpleListFilter,
|
SimpleListFilter as SimpleListFilter,
|
||||||
)
|
)
|
||||||
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME as ACTION_CHECKBOX_NAME
|
from .helpers import ACTION_CHECKBOX_NAME as ACTION_CHECKBOX_NAME
|
||||||
from django.contrib.admin.options import (
|
from .options import (
|
||||||
HORIZONTAL as HORIZONTAL,
|
HORIZONTAL as HORIZONTAL,
|
||||||
VERTICAL as VERTICAL,
|
VERTICAL as VERTICAL,
|
||||||
ModelAdmin as ModelAdmin,
|
ModelAdmin as ModelAdmin,
|
||||||
StackedInline as StackedInline,
|
StackedInline as StackedInline,
|
||||||
TabularInline as TabularInline,
|
TabularInline as TabularInline,
|
||||||
)
|
)
|
||||||
from django.contrib.admin.sites import AdminSite as AdminSite, site as site
|
from .sites import AdminSite as AdminSite, site as site
|
||||||
|
from . import checks as checks
|
||||||
|
|
||||||
def autodiscover() -> None: ...
|
def autodiscover() -> None: ...
|
||||||
|
|||||||
@@ -1,25 +1,6 @@
|
|||||||
from typing import Any
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
class SimpleAdminConfig(AppConfig):
|
class SimpleAdminConfig(AppConfig):
|
||||||
apps: None
|
|
||||||
label: str
|
|
||||||
models: None
|
|
||||||
models_module: None
|
|
||||||
module: Any
|
|
||||||
path: str
|
|
||||||
default_site: str = ...
|
default_site: str = ...
|
||||||
name: str = ...
|
|
||||||
verbose_name: Any = ...
|
|
||||||
def ready(self) -> None: ...
|
|
||||||
|
|
||||||
class AdminConfig(SimpleAdminConfig):
|
class AdminConfig(SimpleAdminConfig): ...
|
||||||
apps: None
|
|
||||||
label: str
|
|
||||||
models: None
|
|
||||||
models_module: None
|
|
||||||
module: Any
|
|
||||||
name: str
|
|
||||||
path: str
|
|
||||||
def ready(self) -> None: ...
|
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
from typing import Any, List
|
from typing import Any, List, Union, Optional, Sequence
|
||||||
|
|
||||||
from django.contrib.admin.options import BaseModelAdmin, InlineModelAdmin, ModelAdmin
|
from django.contrib.admin.options import BaseModelAdmin
|
||||||
from django.core.checks.messages import Error
|
from django.core.checks.messages import CheckMessage, Error
|
||||||
|
|
||||||
def check_admin_app(app_configs: None, **kwargs: Any) -> List[str]: ...
|
from django.apps.config import AppConfig
|
||||||
def check_dependencies(**kwargs: Any) -> List[Error]: ...
|
|
||||||
|
_CheckError = Union[str, Error]
|
||||||
|
|
||||||
|
def check_admin_app(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[_CheckError]: ...
|
||||||
|
def check_dependencies(**kwargs: Any) -> List[_CheckError]: ...
|
||||||
|
|
||||||
class BaseModelAdminChecks:
|
class BaseModelAdminChecks:
|
||||||
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> List[Error]: ...
|
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> List[CheckMessage]: ...
|
||||||
|
|
||||||
class ModelAdminChecks(BaseModelAdminChecks):
|
class ModelAdminChecks(BaseModelAdminChecks): ...
|
||||||
def check(self, admin_obj: ModelAdmin, **kwargs: Any) -> List[Error]: ...
|
class InlineModelAdminChecks(BaseModelAdminChecks): ...
|
||||||
|
|
||||||
class InlineModelAdminChecks(BaseModelAdminChecks):
|
|
||||||
def check(self, inline_obj: InlineModelAdmin, **kwargs: Any) -> List[Any]: ...
|
|
||||||
|
|
||||||
def must_be(type: Any, option: Any, obj: Any, id: Any): ...
|
def must_be(type: Any, option: Any, obj: Any, id: Any): ...
|
||||||
def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any): ...
|
def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any): ...
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable, Optional, Type
|
||||||
|
|
||||||
def register(*models: Any, site: Optional[Any] = ...) -> Callable: ...
|
from django.contrib.admin.sites import AdminSite
|
||||||
|
from django.db.models.base import Model
|
||||||
|
|
||||||
|
def register(*models: Type[Model], site: Optional[AdminSite] = ...) -> Callable: ...
|
||||||
|
|||||||
4
django-stubs/contrib/admin/exceptions.pyi
Normal file
4
django-stubs/contrib/admin/exceptions.pyi
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
from django.core.exceptions import SuspiciousOperation as SuspiciousOperation
|
||||||
|
|
||||||
|
class DisallowedModelAdminLookup(SuspiciousOperation): ...
|
||||||
|
class DisallowedModelAdminToField(SuspiciousOperation): ...
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Iterator
|
||||||
|
|
||||||
from django.contrib.admin.options import ModelAdmin
|
from django.contrib.admin.options import ModelAdmin
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
@@ -16,7 +16,7 @@ class ListFilter:
|
|||||||
self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin
|
self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def has_output(self) -> bool: ...
|
def has_output(self) -> bool: ...
|
||||||
def choices(self, changelist: Any) -> None: ...
|
def choices(self, changelist: Any) -> Optional[Iterator[Dict[str, Any]]]: ...
|
||||||
def queryset(self, request: Any, queryset: QuerySet) -> Optional[QuerySet]: ...
|
def queryset(self, request: Any, queryset: QuerySet) -> Optional[QuerySet]: ...
|
||||||
def expected_parameters(self) -> Optional[List[str]]: ...
|
def expected_parameters(self) -> Optional[List[str]]: ...
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ class SimpleListFilter(ListFilter):
|
|||||||
parameter_name: Any = ...
|
parameter_name: Any = ...
|
||||||
lookup_choices: Any = ...
|
lookup_choices: Any = ...
|
||||||
def value(self) -> Optional[str]: ...
|
def value(self) -> Optional[str]: ...
|
||||||
def lookups(self, request: Any, model_admin: Any) -> None: ...
|
def lookups(self, request: Any, model_admin: Any) -> List[Tuple[Any, str]]: ...
|
||||||
|
|
||||||
class FieldListFilter(ListFilter):
|
class FieldListFilter(ListFilter):
|
||||||
field: Field = ...
|
field: Field = ...
|
||||||
|
|||||||
@@ -1,33 +1,7 @@
|
|||||||
from typing import Any, Dict
|
|
||||||
|
|
||||||
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
|
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
|
||||||
class AdminAuthenticationForm(AuthenticationForm):
|
class AdminAuthenticationForm(AuthenticationForm):
|
||||||
auto_id: str
|
|
||||||
data: Dict[str, str]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: type
|
|
||||||
fields: Dict[Any, Any]
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[Any, Any]
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
request: None
|
|
||||||
user_cache: None
|
|
||||||
error_messages: Any = ...
|
|
||||||
required_css_class: str = ...
|
required_css_class: str = ...
|
||||||
def confirm_login_allowed(self, user: User) -> None: ...
|
|
||||||
|
|
||||||
class AdminPasswordChangeForm(PasswordChangeForm):
|
class AdminPasswordChangeForm(PasswordChangeForm):
|
||||||
auto_id: str
|
|
||||||
data: Dict[Any, Any]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: type
|
|
||||||
fields: Dict[Any, Any]
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[Any, Any]
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
user: Any
|
|
||||||
required_css_class: str = ...
|
required_css_class: str = ...
|
||||||
|
|||||||
@@ -1,27 +1,17 @@
|
|||||||
import collections
|
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union, Iterable
|
||||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union, Type
|
|
||||||
|
|
||||||
from django import forms
|
from django.forms.boundfield import BoundField
|
||||||
from django.contrib.auth.forms import AdminPasswordChangeForm
|
from django.forms.forms import BaseForm
|
||||||
from django.db.models.fields import AutoField
|
from django.forms.utils import ErrorDict
|
||||||
from django.forms.utils import ErrorDict, ErrorList
|
|
||||||
from django.forms.widgets import Media, Widget
|
from django.forms.widgets import Media, Widget
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
from django.forms.boundfield import BoundField
|
from django import forms
|
||||||
|
from django.db.models.fields import AutoField
|
||||||
|
|
||||||
ACTION_CHECKBOX_NAME: str
|
ACTION_CHECKBOX_NAME: str
|
||||||
|
|
||||||
class ActionForm(forms.Form):
|
class ActionForm(forms.Form):
|
||||||
auto_id: None
|
|
||||||
data: Dict[Any, Any]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: Type[ErrorList]
|
|
||||||
fields: collections.OrderedDict
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[Any, Any]
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
action: Any = ...
|
action: Any = ...
|
||||||
select_across: Any = ...
|
select_across: Any = ...
|
||||||
|
|
||||||
@@ -33,11 +23,11 @@ class AdminForm:
|
|||||||
readonly_fields: Any = ...
|
readonly_fields: Any = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
form: AdminPasswordChangeForm,
|
form: BaseForm,
|
||||||
fieldsets: List[Tuple[None, Dict[str, List[str]]]],
|
fieldsets: List[Tuple[None, Dict[str, List[str]]]],
|
||||||
prepopulated_fields: Dict[Any, Any],
|
prepopulated_fields: Dict[Any, Any],
|
||||||
readonly_fields: None = ...,
|
readonly_fields: Optional[Iterable[Any]] = ...,
|
||||||
model_admin: None = ...,
|
model_admin: Any = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __iter__(self) -> Iterator[Fieldset]: ...
|
def __iter__(self) -> Iterator[Fieldset]: ...
|
||||||
@property
|
@property
|
||||||
@@ -57,7 +47,7 @@ class Fieldset:
|
|||||||
self,
|
self,
|
||||||
form: Any,
|
form: Any,
|
||||||
name: Optional[Any] = ...,
|
name: Optional[Any] = ...,
|
||||||
readonly_fields: Any = ...,
|
readonly_fields: Optional[Iterable[Any]] = ...,
|
||||||
fields: Any = ...,
|
fields: Any = ...,
|
||||||
classes: Any = ...,
|
classes: Any = ...,
|
||||||
description: Optional[Any] = ...,
|
description: Optional[Any] = ...,
|
||||||
@@ -74,7 +64,7 @@ class Fieldline:
|
|||||||
model_admin: Any = ...
|
model_admin: Any = ...
|
||||||
readonly_fields: Any = ...
|
readonly_fields: Any = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self, form: Any, field: Any, readonly_fields: Optional[Any] = ..., model_admin: Optional[Any] = ...
|
self, form: Any, field: Any, readonly_fields: Optional[Iterable[Any]] = ..., model_admin: Optional[Any] = ...
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __iter__(self) -> Iterator[Union[AdminField, AdminReadonlyField]]: ...
|
def __iter__(self) -> Iterator[Union[AdminField, AdminReadonlyField]]: ...
|
||||||
def errors(self) -> SafeText: ...
|
def errors(self) -> SafeText: ...
|
||||||
@@ -137,7 +127,6 @@ class InlineAdminFormSet:
|
|||||||
|
|
||||||
class InlineAdminForm(AdminForm):
|
class InlineAdminForm(AdminForm):
|
||||||
formset: Any = ...
|
formset: Any = ...
|
||||||
model_admin: Any = ...
|
|
||||||
original: Any = ...
|
original: Any = ...
|
||||||
show_url: Any = ...
|
show_url: Any = ...
|
||||||
absolute_url: Any = ...
|
absolute_url: Any = ...
|
||||||
@@ -152,7 +141,6 @@ class InlineAdminForm(AdminForm):
|
|||||||
model_admin: Optional[Any] = ...,
|
model_admin: Optional[Any] = ...,
|
||||||
view_on_site_url: Optional[Any] = ...,
|
view_on_site_url: Optional[Any] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __iter__(self) -> Iterator[InlineFieldset]: ...
|
|
||||||
def needs_explicit_pk_field(self) -> Union[bool, AutoField]: ...
|
def needs_explicit_pk_field(self) -> Union[bool, AutoField]: ...
|
||||||
def pk_field(self) -> AdminField: ...
|
def pk_field(self) -> AdminField: ...
|
||||||
def fk_field(self) -> AdminField: ...
|
def fk_field(self) -> AdminField: ...
|
||||||
@@ -162,9 +150,6 @@ class InlineAdminForm(AdminForm):
|
|||||||
class InlineFieldset(Fieldset):
|
class InlineFieldset(Fieldset):
|
||||||
formset: Any = ...
|
formset: Any = ...
|
||||||
def __init__(self, formset: Any, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, formset: Any, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def __iter__(self) -> Iterator[Fieldline]: ...
|
|
||||||
|
|
||||||
class AdminErrorList(forms.utils.ErrorList):
|
class AdminErrorList(forms.utils.ErrorList):
|
||||||
data: List[Any]
|
|
||||||
error_class: str
|
|
||||||
def __init__(self, form: Any, inline_formsets: Any) -> None: ...
|
def __init__(self, form: Any, inline_formsets: Any) -> None: ...
|
||||||
|
|||||||
@@ -1,20 +1,17 @@
|
|||||||
import datetime
|
from typing import Any, Optional, Union
|
||||||
from typing import Any, Dict, List, Optional, Union
|
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from django.db import models
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
ADDITION: int
|
ADDITION: int
|
||||||
CHANGE: int
|
CHANGE: int
|
||||||
DELETION: int
|
DELETION: int
|
||||||
ACTION_FLAG_CHOICES: Any
|
ACTION_FLAG_CHOICES: Any
|
||||||
|
|
||||||
class LogEntryManager(models.Manager):
|
class LogEntryManager(models.Manager["LogEntry"]):
|
||||||
creation_counter: int
|
|
||||||
model: None
|
|
||||||
name: None
|
|
||||||
use_in_migrations: bool = ...
|
|
||||||
def log_action(
|
def log_action(
|
||||||
self,
|
self,
|
||||||
user_id: int,
|
user_id: int,
|
||||||
@@ -22,28 +19,18 @@ class LogEntryManager(models.Manager):
|
|||||||
object_id: Union[int, str, UUID],
|
object_id: Union[int, str, UUID],
|
||||||
object_repr: str,
|
object_repr: str,
|
||||||
action_flag: int,
|
action_flag: int,
|
||||||
change_message: Union[
|
change_message: Any = ...,
|
||||||
Dict[str, Dict[str, List[str]]], List[Dict[str, Dict[str, Union[List[str], str]]]], str
|
|
||||||
] = ...,
|
|
||||||
) -> LogEntry: ...
|
) -> LogEntry: ...
|
||||||
|
|
||||||
class LogEntry(models.Model):
|
class LogEntry(models.Model):
|
||||||
content_type_id: int
|
action_time: models.DateTimeField = ...
|
||||||
id: None
|
user: models.ForeignKey = ...
|
||||||
user_id: int
|
content_type: models.ForeignKey = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
||||||
action_time: datetime.datetime = ...
|
object_id: models.TextField = ...
|
||||||
user: Any = ...
|
object_repr: models.CharField = ...
|
||||||
content_type: Any = ...
|
action_flag: models.PositiveSmallIntegerField = ...
|
||||||
object_id: str = ...
|
change_message: models.TextField = ...
|
||||||
object_repr: str = ...
|
objects: LogEntryManager = ...
|
||||||
action_flag: int = ...
|
|
||||||
change_message: str = ...
|
|
||||||
objects: Any = ...
|
|
||||||
class Meta:
|
|
||||||
verbose_name: Any = ...
|
|
||||||
verbose_name_plural: Any = ...
|
|
||||||
db_table: str = ...
|
|
||||||
ordering: Any = ...
|
|
||||||
def is_addition(self) -> bool: ...
|
def is_addition(self) -> bool: ...
|
||||||
def is_change(self) -> bool: ...
|
def is_change(self) -> bool: ...
|
||||||
def is_deletion(self) -> bool: ...
|
def is_deletion(self) -> bool: ...
|
||||||
|
|||||||
@@ -1,33 +1,54 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
|
from typing import (
|
||||||
|
Any,
|
||||||
|
Callable,
|
||||||
|
Dict,
|
||||||
|
Generic,
|
||||||
|
Iterator,
|
||||||
|
List,
|
||||||
|
Optional,
|
||||||
|
Sequence,
|
||||||
|
Set,
|
||||||
|
Tuple,
|
||||||
|
Type,
|
||||||
|
Union,
|
||||||
|
Mapping,
|
||||||
|
TypeVar,
|
||||||
|
)
|
||||||
|
|
||||||
from django.contrib.admin.filters import SimpleListFilter
|
from django.forms.forms import BaseForm
|
||||||
|
from django.forms.models import BaseInlineFormSet
|
||||||
|
from typing_extensions import Literal, TypedDict
|
||||||
|
|
||||||
|
from django.contrib.admin.filters import ListFilter
|
||||||
from django.contrib.admin.models import LogEntry
|
from django.contrib.admin.models import LogEntry
|
||||||
from django.contrib.admin.sites import AdminSite
|
from django.contrib.admin.sites import AdminSite
|
||||||
from django.contrib.admin.views.main import ChangeList
|
from django.contrib.admin.views.main import ChangeList
|
||||||
from django.contrib.auth.forms import AdminPasswordChangeForm
|
from django.contrib.auth.forms import AdminPasswordChangeForm
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core.checks.messages import Error
|
from django.core.checks.messages import CheckMessage
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.forms.fields import TypedChoiceField
|
|
||||||
|
|
||||||
from django.db.models.fields import Field
|
|
||||||
from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField
|
from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField
|
||||||
|
from django.db.models.options import Options
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
from django.forms.fields import TypedChoiceField
|
||||||
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
|
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
|
||||||
from django.forms.widgets import Media
|
from django.forms.widgets import Media
|
||||||
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse
|
from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse
|
||||||
|
from django.template.response import TemplateResponse
|
||||||
from django.urls.resolvers import URLPattern
|
from django.urls.resolvers import URLPattern
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
from django.db.models.options import Options
|
from django.db.models.fields import Field
|
||||||
|
|
||||||
IS_POPUP_VAR: str
|
IS_POPUP_VAR: str
|
||||||
TO_FIELD_VAR: str
|
TO_FIELD_VAR: str
|
||||||
HORIZONTAL: Any
|
HORIZONTAL: Literal[1] = ...
|
||||||
VERTICAL: Any
|
VERTICAL: Literal[2] = ...
|
||||||
|
|
||||||
|
_Direction = Union[Literal[1], Literal[2]]
|
||||||
|
|
||||||
def get_content_type_for_model(obj: Union[Type[Model], Model]) -> ContentType: ...
|
def get_content_type_for_model(obj: Union[Type[Model], Model]) -> ContentType: ...
|
||||||
def get_ul_class(radio_style: int) -> str: ...
|
def get_ul_class(radio_style: int) -> str: ...
|
||||||
@@ -37,162 +58,169 @@ class IncorrectLookupParameters(Exception): ...
|
|||||||
FORMFIELD_FOR_DBFIELD_DEFAULTS: Any
|
FORMFIELD_FOR_DBFIELD_DEFAULTS: Any
|
||||||
csrf_protect_m: Any
|
csrf_protect_m: Any
|
||||||
|
|
||||||
class BaseModelAdmin:
|
class _OptionalFieldOpts(TypedDict, total=False):
|
||||||
autocomplete_fields: Any = ...
|
classes: Sequence[str]
|
||||||
raw_id_fields: Any = ...
|
description: str
|
||||||
fields: Any = ...
|
|
||||||
exclude: Any = ...
|
class _FieldOpts(_OptionalFieldOpts, total=True):
|
||||||
fieldsets: Any = ...
|
fields: Sequence[Union[str, Sequence[str]]]
|
||||||
form: Any = ...
|
|
||||||
filter_vertical: Any = ...
|
# Workaround for mypy issue, a Sequence type should be preferred here.
|
||||||
filter_horizontal: Any = ...
|
# https://github.com/python/mypy/issues/8921
|
||||||
radio_fields: Any = ...
|
# _FieldsetSpec = Sequence[Tuple[Optional[str], _FieldOpts]]
|
||||||
prepopulated_fields: Any = ...
|
_T = TypeVar("_T")
|
||||||
formfield_overrides: Any = ...
|
_ListOrTuple = Union[Tuple[_T, ...], List[_T]]
|
||||||
readonly_fields: Any = ...
|
_FieldsetSpec = _ListOrTuple[Tuple[Optional[str], _FieldOpts]]
|
||||||
ordering: Any = ...
|
|
||||||
sortable_by: Any = ...
|
# Generic type specifically for models, for use in BaseModelAdmin and subclasses
|
||||||
|
# https://github.com/typeddjango/django-stubs/issues/482
|
||||||
|
_ModelT = TypeVar("_ModelT", bound=Model)
|
||||||
|
|
||||||
|
class BaseModelAdmin(Generic[_ModelT]):
|
||||||
|
autocomplete_fields: Sequence[str] = ...
|
||||||
|
raw_id_fields: Sequence[str] = ...
|
||||||
|
fields: Sequence[Union[str, Sequence[str]]] = ...
|
||||||
|
exclude: Sequence[str] = ...
|
||||||
|
fieldsets: _FieldsetSpec = ...
|
||||||
|
form: Type[BaseForm] = ...
|
||||||
|
filter_vertical: Sequence[str] = ...
|
||||||
|
filter_horizontal: Sequence[str] = ...
|
||||||
|
radio_fields: Mapping[str, _Direction] = ...
|
||||||
|
prepopulated_fields: Mapping[str, Sequence[str]] = ...
|
||||||
|
formfield_overrides: Mapping[Type[Field], Mapping[str, Any]] = ...
|
||||||
|
readonly_fields: Sequence[Union[str, Callable[[_ModelT], Any]]] = ...
|
||||||
|
ordering: Sequence[str] = ...
|
||||||
|
sortable_by: Sequence[str] = ...
|
||||||
view_on_site: bool = ...
|
view_on_site: bool = ...
|
||||||
show_full_result_count: bool = ...
|
show_full_result_count: bool = ...
|
||||||
checks_class: Any = ...
|
checks_class: Any = ...
|
||||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
def check(self, **kwargs: Any) -> List[CheckMessage]: ...
|
||||||
def __init__(self) -> None: ...
|
def formfield_for_dbfield(
|
||||||
def formfield_for_dbfield(self, db_field: Field, request: WSGIRequest, **kwargs: Any) -> Optional[Field]: ...
|
self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any
|
||||||
def formfield_for_choice_field(self, db_field: Field, request: WSGIRequest, **kwargs: Any) -> TypedChoiceField: ...
|
) -> Optional[Field]: ...
|
||||||
def get_field_queryset(self, db: None, db_field: RelatedField, request: WSGIRequest) -> Optional[QuerySet]: ...
|
def formfield_for_choice_field(
|
||||||
|
self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any
|
||||||
|
) -> TypedChoiceField: ...
|
||||||
|
def get_field_queryset(
|
||||||
|
self, db: None, db_field: RelatedField, request: Optional[HttpRequest]
|
||||||
|
) -> Optional[QuerySet]: ...
|
||||||
def formfield_for_foreignkey(
|
def formfield_for_foreignkey(
|
||||||
self, db_field: ForeignKey, request: WSGIRequest, **kwargs: Any
|
self, db_field: ForeignKey, request: Optional[HttpRequest], **kwargs: Any
|
||||||
) -> Optional[ModelChoiceField]: ...
|
) -> Optional[ModelChoiceField]: ...
|
||||||
def formfield_for_manytomany(
|
def formfield_for_manytomany(
|
||||||
self, db_field: ManyToManyField, request: WSGIRequest, **kwargs: Any
|
self, db_field: ManyToManyField, request: Optional[HttpRequest], **kwargs: Any
|
||||||
) -> ModelMultipleChoiceField: ...
|
) -> ModelMultipleChoiceField: ...
|
||||||
def get_autocomplete_fields(self, request: WSGIRequest) -> Tuple: ...
|
def get_autocomplete_fields(self, request: HttpRequest) -> Tuple: ...
|
||||||
def get_view_on_site_url(self, obj: Optional[Model] = ...) -> Optional[str]: ...
|
def get_view_on_site_url(self, obj: Optional[_ModelT] = ...) -> Optional[str]: ...
|
||||||
def get_empty_value_display(self) -> SafeText: ...
|
def get_empty_value_display(self) -> SafeText: ...
|
||||||
def get_exclude(self, request: WSGIRequest, obj: Optional[Model] = ...) -> None: ...
|
def get_exclude(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> Any: ...
|
||||||
def get_fields(
|
def get_fields(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> Sequence[Union[Callable, str]]: ...
|
||||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
|
||||||
) -> Union[List[Union[Callable, str]], Tuple[str, str]]: ...
|
|
||||||
def get_fieldsets(
|
def get_fieldsets(
|
||||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
self, request: HttpRequest, obj: Optional[_ModelT] = ...
|
||||||
) -> Union[
|
) -> List[Tuple[Optional[str], Dict[str, Any]]]: ...
|
||||||
List[Tuple[None, Dict[str, List[Union[Callable, str]]]]],
|
def get_ordering(self, request: HttpRequest) -> Union[List[str], Tuple]: ...
|
||||||
Tuple[Tuple[Optional[str], Dict[str, Tuple[Union[Tuple[str, str], str]]]]],
|
def get_readonly_fields(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> Union[List[str], Tuple]: ...
|
||||||
]: ...
|
def get_prepopulated_fields(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> Dict[str, Tuple[str]]: ...
|
||||||
def get_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
|
def get_queryset(self, request: HttpRequest) -> QuerySet: ...
|
||||||
def get_readonly_fields(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Union[List[str], Tuple]: ...
|
def get_sortable_by(self, request: HttpRequest) -> Union[List[Callable], List[str], Tuple]: ...
|
||||||
def get_prepopulated_fields(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Dict[str, Tuple[str]]: ...
|
|
||||||
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
|
|
||||||
def get_sortable_by(self, request: WSGIRequest) -> Union[List[Callable], List[str], Tuple]: ...
|
|
||||||
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
|
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
|
||||||
def to_field_allowed(self, request: WSGIRequest, to_field: str) -> bool: ...
|
def to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ...
|
||||||
def has_add_permission(self, request: WSGIRequest) -> bool: ...
|
def has_add_permission(self, request: HttpRequest) -> bool: ...
|
||||||
def has_change_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
def has_change_permission(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> bool: ...
|
||||||
def has_delete_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
def has_delete_permission(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> bool: ...
|
||||||
def has_view_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
def has_view_permission(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> bool: ...
|
||||||
def has_module_permission(self, request: WSGIRequest) -> bool: ...
|
def has_module_permission(self, request: HttpRequest) -> bool: ...
|
||||||
|
|
||||||
class ModelAdmin(BaseModelAdmin):
|
class ModelAdmin(BaseModelAdmin[_ModelT]):
|
||||||
formfield_overrides: Any
|
list_display: Sequence[Union[str, Callable[[_ModelT], Any]]] = ...
|
||||||
list_display: Any = ...
|
list_display_links: Optional[Sequence[Union[str, Callable]]] = ...
|
||||||
list_display_links: Any = ...
|
list_filter: Sequence[Union[str, Type[ListFilter], Tuple[str, Type[ListFilter]]]] = ...
|
||||||
list_filter: Any = ...
|
list_select_related: Union[bool, Sequence[str]] = ...
|
||||||
list_select_related: bool = ...
|
|
||||||
list_per_page: int = ...
|
list_per_page: int = ...
|
||||||
list_max_show_all: int = ...
|
list_max_show_all: int = ...
|
||||||
list_editable: Any = ...
|
list_editable: Sequence[str] = ...
|
||||||
search_fields: Any = ...
|
search_fields: Sequence[str] = ...
|
||||||
date_hierarchy: Any = ...
|
date_hierarchy: Optional[str] = ...
|
||||||
save_as: bool = ...
|
save_as: bool = ...
|
||||||
save_as_continue: bool = ...
|
save_as_continue: bool = ...
|
||||||
save_on_top: bool = ...
|
save_on_top: bool = ...
|
||||||
paginator: Any = ...
|
paginator: Type = ...
|
||||||
preserve_filters: bool = ...
|
preserve_filters: bool = ...
|
||||||
inlines: Any = ...
|
inlines: Sequence[Type[InlineModelAdmin]] = ...
|
||||||
add_form_template: Any = ...
|
add_form_template: str = ...
|
||||||
change_form_template: Any = ...
|
change_form_template: str = ...
|
||||||
change_list_template: Any = ...
|
change_list_template: str = ...
|
||||||
delete_confirmation_template: Any = ...
|
delete_confirmation_template: str = ...
|
||||||
delete_selected_confirmation_template: Any = ...
|
delete_selected_confirmation_template: str = ...
|
||||||
object_history_template: Any = ...
|
object_history_template: str = ...
|
||||||
popup_response_template: Any = ...
|
popup_response_template: str = ...
|
||||||
actions: Any = ...
|
actions: Optional[Sequence[Union[Callable[[ModelAdmin, HttpRequest, QuerySet], None], str]]] = ...
|
||||||
action_form: Any = ...
|
action_form: Any = ...
|
||||||
actions_on_top: bool = ...
|
actions_on_top: bool = ...
|
||||||
actions_on_bottom: bool = ...
|
actions_on_bottom: bool = ...
|
||||||
actions_selection_counter: bool = ...
|
actions_selection_counter: bool = ...
|
||||||
checks_class: Any = ...
|
model: Type[_ModelT] = ...
|
||||||
model: Type[Model] = ...
|
|
||||||
opts: Options = ...
|
opts: Options = ...
|
||||||
admin_site: AdminSite = ...
|
admin_site: AdminSite = ...
|
||||||
def __init__(self, model: Type[Model], admin_site: Optional[AdminSite]) -> None: ...
|
def __init__(self, model: Type[_ModelT], admin_site: Optional[AdminSite]) -> None: ...
|
||||||
def get_inline_instances(self, request: WSGIRequest, obj: Optional[Model] = ...) -> List[InlineModelAdmin]: ...
|
def get_inlines(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> List[Type[InlineModelAdmin]]: ...
|
||||||
|
def get_inline_instances(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> List[InlineModelAdmin]: ...
|
||||||
def get_urls(self) -> List[URLPattern]: ...
|
def get_urls(self) -> List[URLPattern]: ...
|
||||||
@property
|
@property
|
||||||
def urls(self) -> List[URLPattern]: ...
|
def urls(self) -> List[URLPattern]: ...
|
||||||
@property
|
@property
|
||||||
def media(self) -> Media: ...
|
def media(self) -> Media: ...
|
||||||
def get_model_perms(self, request: WSGIRequest) -> Dict[str, bool]: ...
|
def get_model_perms(self, request: HttpRequest) -> Dict[str, bool]: ...
|
||||||
def get_form(self, request: Any, obj: Optional[Any] = ..., change: bool = ..., **kwargs: Any): ...
|
def get_form(self, request: Any, obj: Optional[_ModelT] = ..., change: bool = ..., **kwargs: Any): ...
|
||||||
def get_changelist(self, request: WSGIRequest, **kwargs: Any) -> Type[ChangeList]: ...
|
def get_changelist(self, request: HttpRequest, **kwargs: Any) -> Type[ChangeList]: ...
|
||||||
def get_changelist_instance(self, request: WSGIRequest) -> ChangeList: ...
|
def get_changelist_instance(self, request: HttpRequest) -> ChangeList: ...
|
||||||
def get_object(self, request: WSGIRequest, object_id: str, from_field: None = ...) -> Optional[Model]: ...
|
def get_object(self, request: HttpRequest, object_id: str, from_field: None = ...) -> Optional[_ModelT]: ...
|
||||||
def get_changelist_form(self, request: Any, **kwargs: Any): ...
|
def get_changelist_form(self, request: Any, **kwargs: Any): ...
|
||||||
def get_changelist_formset(self, request: Any, **kwargs: Any): ...
|
def get_changelist_formset(self, request: Any, **kwargs: Any): ...
|
||||||
def get_formsets_with_inlines(self, request: WSGIRequest, obj: Optional[Model] = ...) -> None: ...
|
def get_formsets_with_inlines(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> Iterator[Any]: ...
|
||||||
def get_paginator(
|
def get_paginator(
|
||||||
self,
|
self,
|
||||||
request: WSGIRequest,
|
request: HttpRequest,
|
||||||
queryset: QuerySet,
|
queryset: QuerySet,
|
||||||
per_page: int,
|
per_page: int,
|
||||||
orphans: int = ...,
|
orphans: int = ...,
|
||||||
allow_empty_first_page: bool = ...,
|
allow_empty_first_page: bool = ...,
|
||||||
) -> Paginator: ...
|
) -> Paginator: ...
|
||||||
def log_addition(
|
def log_addition(self, request: HttpRequest, object: _ModelT, message: Any) -> LogEntry: ...
|
||||||
self,
|
def log_change(self, request: HttpRequest, object: _ModelT, message: Any) -> LogEntry: ...
|
||||||
request: WSGIRequest,
|
def log_deletion(self, request: HttpRequest, object: _ModelT, object_repr: str) -> LogEntry: ...
|
||||||
object: Model,
|
def action_checkbox(self, obj: _ModelT) -> SafeText: ...
|
||||||
message: Union[Dict[str, Dict[Any, Any]], List[Dict[str, Dict[str, str]]]],
|
def get_actions(self, request: HttpRequest) -> OrderedDict: ...
|
||||||
) -> LogEntry: ...
|
|
||||||
def log_change(
|
|
||||||
self,
|
|
||||||
request: WSGIRequest,
|
|
||||||
object: Model,
|
|
||||||
message: Union[Dict[str, Dict[str, List[str]]], List[Dict[str, Dict[str, Union[List[str], str]]]]],
|
|
||||||
) -> LogEntry: ...
|
|
||||||
def log_deletion(self, request: WSGIRequest, object: Model, object_repr: str) -> LogEntry: ...
|
|
||||||
def action_checkbox(self, obj: Model) -> SafeText: ...
|
|
||||||
def get_actions(self, request: WSGIRequest) -> OrderedDict: ...
|
|
||||||
def get_action_choices(
|
def get_action_choices(
|
||||||
self, request: WSGIRequest, default_choices: List[Tuple[str, str]] = ...
|
self, request: HttpRequest, default_choices: List[Tuple[str, str]] = ...
|
||||||
) -> List[Tuple[str, str]]: ...
|
) -> List[Tuple[str, str]]: ...
|
||||||
def get_action(self, action: Union[Callable, str]) -> Tuple[Callable, str, str]: ...
|
def get_action(self, action: Union[Callable, str]) -> Tuple[Callable, str, str]: ...
|
||||||
def get_list_display(self, request: WSGIRequest) -> Union[List[Callable], List[str], Tuple[str]]: ...
|
def get_list_display(self, request: HttpRequest) -> Sequence[str]: ...
|
||||||
def get_list_display_links(
|
def get_list_display_links(self, request: HttpRequest, list_display: Sequence[str]) -> Optional[Sequence[str]]: ...
|
||||||
self, request: WSGIRequest, list_display: Union[List[Callable], List[str], Tuple[str]]
|
def get_list_filter(self, request: HttpRequest) -> Sequence[str]: ...
|
||||||
) -> Optional[Union[List[Callable], List[str], Tuple[str]]]: ...
|
def get_list_select_related(self, request: HttpRequest) -> Sequence[str]: ...
|
||||||
def get_list_filter(self, request: WSGIRequest) -> Union[List[Type[SimpleListFilter]], List[str], Tuple]: ...
|
def get_search_fields(self, request: HttpRequest) -> List[str]: ...
|
||||||
def get_list_select_related(self, request: WSGIRequest) -> Union[Tuple, bool]: ...
|
|
||||||
def get_search_fields(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
|
|
||||||
def get_search_results(
|
def get_search_results(
|
||||||
self, request: WSGIRequest, queryset: QuerySet, search_term: str
|
self, request: HttpRequest, queryset: QuerySet, search_term: str
|
||||||
) -> Tuple[QuerySet, bool]: ...
|
) -> Tuple[QuerySet, bool]: ...
|
||||||
def get_preserved_filters(self, request: WSGIRequest) -> str: ...
|
def get_preserved_filters(self, request: HttpRequest) -> str: ...
|
||||||
|
def _get_edited_object_pks(self, request: HttpRequest, prefix: str) -> List[str]: ...
|
||||||
|
def _get_list_editable_queryset(self, request: HttpRequest, prefix: str) -> QuerySet: ...
|
||||||
def construct_change_message(
|
def construct_change_message(
|
||||||
self, request: WSGIRequest, form: AdminPasswordChangeForm, formsets: None, add: bool = ...
|
self, request: HttpRequest, form: AdminPasswordChangeForm, formsets: None, add: bool = ...
|
||||||
) -> List[Dict[str, Dict[str, List[str]]]]: ...
|
) -> List[Dict[str, Dict[str, List[str]]]]: ...
|
||||||
def message_user(
|
def message_user(
|
||||||
self,
|
self,
|
||||||
request: WSGIRequest,
|
request: HttpRequest,
|
||||||
message: str,
|
message: str,
|
||||||
level: Union[int, str] = ...,
|
level: Union[int, str] = ...,
|
||||||
extra_tags: str = ...,
|
extra_tags: str = ...,
|
||||||
fail_silently: bool = ...,
|
fail_silently: bool = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def save_form(self, request: Any, form: Any, change: Any): ...
|
def save_form(self, request: Any, form: Any, change: Any): ...
|
||||||
def save_model(self, request: Any, obj: Any, form: Any, change: Any) -> None: ...
|
def save_model(self, request: Any, obj: _ModelT, form: Any, change: Any) -> None: ...
|
||||||
def delete_model(self, request: WSGIRequest, obj: Model) -> None: ...
|
def delete_model(self, request: HttpRequest, obj: _ModelT) -> None: ...
|
||||||
def delete_queryset(self, request: WSGIRequest, queryset: QuerySet) -> None: ...
|
def delete_queryset(self, request: HttpRequest, queryset: QuerySet) -> None: ...
|
||||||
def save_formset(self, request: Any, form: Any, formset: Any, change: Any) -> None: ...
|
def save_formset(self, request: Any, form: Any, formset: Any, change: Any) -> None: ...
|
||||||
def save_related(self, request: Any, form: Any, formsets: Any, change: Any) -> None: ...
|
def save_related(self, request: Any, form: Any, formsets: Any, change: Any) -> None: ...
|
||||||
def render_change_form(
|
def render_change_form(
|
||||||
@@ -202,73 +230,66 @@ class ModelAdmin(BaseModelAdmin):
|
|||||||
add: bool = ...,
|
add: bool = ...,
|
||||||
change: bool = ...,
|
change: bool = ...,
|
||||||
form_url: str = ...,
|
form_url: str = ...,
|
||||||
obj: Optional[Any] = ...,
|
obj: Optional[_ModelT] = ...,
|
||||||
): ...
|
): ...
|
||||||
def response_add(self, request: WSGIRequest, obj: Model, post_url_continue: None = ...) -> HttpResponse: ...
|
def response_add(
|
||||||
def response_change(self, request: WSGIRequest, obj: Model) -> HttpResponse: ...
|
self, request: HttpRequest, obj: _ModelT, post_url_continue: Optional[str] = ...
|
||||||
def response_post_save_add(self, request: WSGIRequest, obj: Model) -> HttpResponseRedirect: ...
|
) -> HttpResponse: ...
|
||||||
def response_post_save_change(self, request: WSGIRequest, obj: Model) -> HttpResponseRedirect: ...
|
def response_change(self, request: HttpRequest, obj: _ModelT) -> HttpResponse: ...
|
||||||
def response_action(self, request: WSGIRequest, queryset: QuerySet) -> Optional[HttpResponseBase]: ...
|
def response_post_save_add(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ...
|
||||||
def response_delete(self, request: WSGIRequest, obj_display: str, obj_id: int) -> HttpResponse: ...
|
def response_post_save_change(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ...
|
||||||
|
def response_action(self, request: HttpRequest, queryset: QuerySet) -> Optional[HttpResponseBase]: ...
|
||||||
|
def response_delete(self, request: HttpRequest, obj_display: str, obj_id: int) -> HttpResponse: ...
|
||||||
def render_delete_form(self, request: Any, context: Any): ...
|
def render_delete_form(self, request: Any, context: Any): ...
|
||||||
def get_inline_formsets(
|
def get_inline_formsets(
|
||||||
self, request: WSGIRequest, formsets: List[Any], inline_instances: List[Any], obj: Optional[Model] = ...
|
self, request: HttpRequest, formsets: List[Any], inline_instances: List[Any], obj: Optional[_ModelT] = ...
|
||||||
) -> List[Any]: ...
|
) -> List[Any]: ...
|
||||||
def get_changeform_initial_data(self, request: WSGIRequest) -> Dict[str, str]: ...
|
def get_changeform_initial_data(self, request: HttpRequest) -> Dict[str, str]: ...
|
||||||
def changeform_view(
|
def changeform_view(
|
||||||
self,
|
self,
|
||||||
request: WSGIRequest,
|
request: HttpRequest,
|
||||||
object_id: Optional[str] = ...,
|
object_id: Optional[str] = ...,
|
||||||
form_url: str = ...,
|
form_url: str = ...,
|
||||||
extra_context: Optional[Dict[str, bool]] = ...,
|
extra_context: Optional[Dict[str, bool]] = ...,
|
||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
def autocomplete_view(self, request: WSGIRequest) -> JsonResponse: ...
|
def autocomplete_view(self, request: HttpRequest) -> JsonResponse: ...
|
||||||
def add_view(self, request: WSGIRequest, form_url: str = ..., extra_context: None = ...) -> HttpResponse: ...
|
def add_view(self, request: HttpRequest, form_url: str = ..., extra_context: None = ...) -> HttpResponse: ...
|
||||||
def change_view(
|
def change_view(
|
||||||
self, request: WSGIRequest, object_id: str, form_url: str = ..., extra_context: Optional[Dict[str, bool]] = ...
|
self, request: HttpRequest, object_id: str, form_url: str = ..., extra_context: Optional[Dict[str, bool]] = ...
|
||||||
) -> HttpResponse: ...
|
) -> HttpResponse: ...
|
||||||
def changelist_view(
|
def changelist_view(
|
||||||
self, request: WSGIRequest, extra_context: Optional[Dict[str, str]] = ...
|
self, request: HttpRequest, extra_context: Optional[Dict[str, str]] = ...
|
||||||
) -> HttpResponseBase: ...
|
) -> TemplateResponse: ...
|
||||||
def get_deleted_objects(
|
def get_deleted_objects(
|
||||||
self, objs: QuerySet, request: WSGIRequest
|
self, objs: QuerySet, request: HttpRequest
|
||||||
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
||||||
def delete_view(self, request: WSGIRequest, object_id: str, extra_context: None = ...) -> Any: ...
|
def delete_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> Any: ...
|
||||||
def history_view(self, request: WSGIRequest, object_id: str, extra_context: None = ...) -> HttpResponse: ...
|
def history_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> HttpResponse: ...
|
||||||
|
|
||||||
class InlineModelAdmin(BaseModelAdmin):
|
class InlineModelAdmin(BaseModelAdmin[_ModelT]):
|
||||||
model: Any = ...
|
model: Type[_ModelT] = ...
|
||||||
fk_name: Any = ...
|
fk_name: str = ...
|
||||||
formset: Any = ...
|
formset: Type[BaseInlineFormSet] = ...
|
||||||
extra: int = ...
|
extra: int = ...
|
||||||
min_num: Any = ...
|
min_num: Optional[int] = ...
|
||||||
max_num: Any = ...
|
max_num: Optional[int] = ...
|
||||||
template: Any = ...
|
template: str = ...
|
||||||
verbose_name: Any = ...
|
verbose_name: Optional[str] = ...
|
||||||
verbose_name_plural: Any = ...
|
verbose_name_plural: Optional[str] = ...
|
||||||
can_delete: bool = ...
|
can_delete: bool = ...
|
||||||
show_change_link: bool = ...
|
show_change_link: bool = ...
|
||||||
checks_class: Any = ...
|
classes: Optional[Sequence[str]] = ...
|
||||||
classes: Any = ...
|
admin_site: AdminSite = ...
|
||||||
admin_site: Any = ...
|
|
||||||
parent_model: Any = ...
|
parent_model: Any = ...
|
||||||
opts: Any = ...
|
opts: Any = ...
|
||||||
has_registered_model: Any = ...
|
has_registered_model: Any = ...
|
||||||
def __init__(self, parent_model: Union[Type[Model], Model], admin_site: AdminSite) -> None: ...
|
def __init__(self, parent_model: Union[Type[_ModelT], _ModelT], admin_site: AdminSite) -> None: ...
|
||||||
@property
|
@property
|
||||||
def media(self) -> Media: ...
|
def media(self) -> Media: ...
|
||||||
def get_extra(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> int: ...
|
def get_extra(self, request: HttpRequest, obj: Optional[_ModelT] = ..., **kwargs: Any) -> int: ...
|
||||||
def get_min_num(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> None: ...
|
def get_min_num(self, request: HttpRequest, obj: Optional[_ModelT] = ..., **kwargs: Any) -> Optional[int]: ...
|
||||||
def get_max_num(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> Optional[int]: ...
|
def get_max_num(self, request: HttpRequest, obj: Optional[_ModelT] = ..., **kwargs: Any) -> Optional[int]: ...
|
||||||
fields: Any = ...
|
def get_formset(self, request: Any, obj: Optional[_ModelT] = ..., **kwargs: Any): ...
|
||||||
def get_formset(self, request: Any, obj: Optional[Any] = ..., **kwargs: Any): ...
|
|
||||||
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
|
|
||||||
def has_change_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
|
||||||
def has_delete_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
|
||||||
def has_view_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
|
|
||||||
|
|
||||||
class StackedInline(InlineModelAdmin):
|
class StackedInline(InlineModelAdmin[_ModelT]): ...
|
||||||
template: str = ...
|
class TabularInline(InlineModelAdmin[_ModelT]): ...
|
||||||
|
|
||||||
class TabularInline(InlineModelAdmin):
|
|
||||||
template: str = ...
|
|
||||||
|
|||||||
@@ -1,65 +1,90 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
import sys
|
||||||
|
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Type, Union
|
||||||
|
|
||||||
|
from django.apps.config import AppConfig
|
||||||
from django.contrib.admin.options import ModelAdmin
|
from django.contrib.admin.options import ModelAdmin
|
||||||
|
from django.contrib.auth.forms import AuthenticationForm
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
|
from django.db.models.query import QuerySet
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.urls.resolvers import URLPattern, URLResolver
|
from django.urls.resolvers import URLResolver
|
||||||
from django.utils.functional import LazyObject
|
from django.utils.functional import LazyObject
|
||||||
|
from django.core.checks import CheckMessage
|
||||||
|
|
||||||
all_sites: Any
|
if sys.version_info >= (3, 9):
|
||||||
|
from weakref import WeakSet
|
||||||
|
|
||||||
|
all_sites: WeakSet[AdminSite]
|
||||||
|
else:
|
||||||
|
from typing import MutableSet
|
||||||
|
|
||||||
|
all_sites: MutableSet[AdminSite]
|
||||||
|
|
||||||
|
_ActionCallback = Callable[[ModelAdmin, WSGIRequest, QuerySet], Optional[TemplateResponse]]
|
||||||
|
|
||||||
class AlreadyRegistered(Exception): ...
|
class AlreadyRegistered(Exception): ...
|
||||||
class NotRegistered(Exception): ...
|
class NotRegistered(Exception): ...
|
||||||
|
|
||||||
class AdminSite:
|
class AdminSite:
|
||||||
site_title: Any = ...
|
site_title: str = ...
|
||||||
site_header: Any = ...
|
site_header: str = ...
|
||||||
index_title: Any = ...
|
index_title: str = ...
|
||||||
site_url: str = ...
|
site_url: str = ...
|
||||||
login_form: Any = ...
|
login_form: Optional[AuthenticationForm] = ...
|
||||||
index_template: Any = ...
|
index_template: Optional[str] = ...
|
||||||
app_index_template: Any = ...
|
app_index_template: Optional[str] = ...
|
||||||
login_template: Any = ...
|
login_template: Optional[str] = ...
|
||||||
logout_template: Any = ...
|
logout_template: Optional[str] = ...
|
||||||
password_change_template: Any = ...
|
password_change_template: Optional[str] = ...
|
||||||
password_change_done_template: Any = ...
|
password_change_done_template: Optional[str] = ...
|
||||||
name: str = ...
|
name: str = ...
|
||||||
|
_empty_value_display: str = ...
|
||||||
|
_registry: Dict[Type[Model], ModelAdmin]
|
||||||
|
_global_actions: Dict[str, _ActionCallback]
|
||||||
|
_actions: Dict[str, _ActionCallback]
|
||||||
def __init__(self, name: str = ...) -> None: ...
|
def __init__(self, name: str = ...) -> None: ...
|
||||||
def check(self, app_configs: None) -> List[str]: ...
|
def check(self, app_configs: Optional[Iterable[AppConfig]]) -> List[CheckMessage]: ...
|
||||||
def register(
|
def register(
|
||||||
self,
|
self,
|
||||||
model_or_iterable: Union[List[Type[Model]], Tuple[Type[Model]], Type[Model]],
|
model_or_iterable: Union[Type[Model], Iterable[Type[Model]]],
|
||||||
admin_class: Optional[Type[ModelAdmin]] = ...,
|
admin_class: Optional[Type[ModelAdmin]] = ...,
|
||||||
**options: Any
|
**options: Any
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def unregister(self, model_or_iterable: Type[Model]) -> None: ...
|
def unregister(self, model_or_iterable: Union[Type[Model], Iterable[Type[Model]]]) -> None: ...
|
||||||
def is_registered(self, model: Type[Model]) -> bool: ...
|
def is_registered(self, model: Type[Model]) -> bool: ...
|
||||||
def add_action(self, action: Callable, name: None = ...) -> None: ...
|
def add_action(self, action: _ActionCallback, name: Optional[str] = ...) -> None: ...
|
||||||
def disable_action(self, name: str) -> None: ...
|
def disable_action(self, name: str) -> None: ...
|
||||||
def get_action(self, name: str) -> Callable: ...
|
def get_action(self, name: str) -> Callable: ...
|
||||||
@property
|
@property
|
||||||
def actions(self): ...
|
def actions(self) -> Iterable[Tuple[str, _ActionCallback]]: ...
|
||||||
@property
|
@property
|
||||||
def empty_value_display(self): ...
|
def empty_value_display(self) -> str: ...
|
||||||
@empty_value_display.setter
|
@empty_value_display.setter
|
||||||
def empty_value_display(self, empty_value_display: Any) -> None: ...
|
def empty_value_display(self, empty_value_display: str) -> None: ...
|
||||||
def has_permission(self, request: WSGIRequest) -> bool: ...
|
def has_permission(self, request: WSGIRequest) -> bool: ...
|
||||||
def admin_view(self, view: Callable, cacheable: bool = ...) -> Callable: ...
|
def admin_view(self, view: Callable, cacheable: bool = ...) -> Callable: ...
|
||||||
def get_urls(self) -> List[Union[URLPattern, URLResolver]]: ...
|
def get_urls(self) -> List[URLResolver]: ...
|
||||||
@property
|
@property
|
||||||
def urls(self) -> Tuple[List[Union[URLPattern, URLResolver]], str, str]: ...
|
def urls(self) -> Tuple[List[URLResolver], str, str]: ...
|
||||||
def each_context(self, request: Any): ...
|
def each_context(self, request: WSGIRequest) -> Dict[str, Any]: ...
|
||||||
def password_change(self, request: WSGIRequest, extra_context: Dict[str, str] = ...) -> TemplateResponse: ...
|
def password_change(
|
||||||
def password_change_done(self, request: WSGIRequest, extra_context: None = ...) -> TemplateResponse: ...
|
self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ...
|
||||||
def i18n_javascript(self, request: WSGIRequest, extra_context: Optional[Dict[Any, Any]] = ...) -> HttpResponse: ...
|
) -> TemplateResponse: ...
|
||||||
def logout(self, request: WSGIRequest, extra_context: None = ...) -> TemplateResponse: ...
|
def password_change_done(
|
||||||
def login(self, request: WSGIRequest, extra_context: None = ...) -> HttpResponse: ...
|
self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ...
|
||||||
|
) -> TemplateResponse: ...
|
||||||
|
def i18n_javascript(self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ...) -> HttpResponse: ...
|
||||||
|
def logout(self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ...) -> TemplateResponse: ...
|
||||||
|
def login(self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ...) -> HttpResponse: ...
|
||||||
|
def _build_app_dict(self, request: WSGIRequest, label: Optional[str] = ...) -> Dict[str, Any]: ...
|
||||||
def get_app_list(self, request: WSGIRequest) -> List[Any]: ...
|
def get_app_list(self, request: WSGIRequest) -> List[Any]: ...
|
||||||
def index(self, request: WSGIRequest, extra_context: Optional[Dict[str, str]] = ...) -> TemplateResponse: ...
|
def index(self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ...) -> TemplateResponse: ...
|
||||||
def app_index(self, request: WSGIRequest, app_label: str, extra_context: None = ...) -> TemplateResponse: ...
|
def app_index(
|
||||||
|
self, request: WSGIRequest, app_label: str, extra_context: Optional[Dict[str, Any]] = ...
|
||||||
|
) -> TemplateResponse: ...
|
||||||
|
|
||||||
class DefaultAdminSite(LazyObject): ...
|
class DefaultAdminSite(LazyObject): ...
|
||||||
|
|
||||||
site: Any
|
site: AdminSite
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Dict, Iterator, List, Optional, Union
|
from typing import Any, Dict, Iterator, List, Optional, Union, Iterable
|
||||||
|
|
||||||
from django.contrib.admin.filters import FieldListFilter
|
from django.contrib.admin.filters import FieldListFilter
|
||||||
from django.contrib.admin.templatetags.base import InclusionAdminNode
|
from django.contrib.admin.templatetags.base import InclusionAdminNode
|
||||||
@@ -15,7 +15,7 @@ register: Any
|
|||||||
DOT: str
|
DOT: str
|
||||||
|
|
||||||
def paginator_number(cl: ChangeList, i: int) -> SafeText: ...
|
def paginator_number(cl: ChangeList, i: int) -> SafeText: ...
|
||||||
def pagination(cl: ChangeList) -> Dict[str, Union[List[Union[int, str]], ChangeList, int, range, str]]: ...
|
def pagination(cl: ChangeList) -> Dict[str, Iterable[Any]]: ...
|
||||||
def pagination_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
def pagination_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||||
def result_headers(cl: ChangeList) -> Iterator[Dict[str, Optional[Union[int, str]]]]: ...
|
def result_headers(cl: ChangeList) -> Iterator[Dict[str, Optional[Union[int, str]]]]: ...
|
||||||
def items_for_result(cl: ChangeList, result: Model, form: None) -> Iterator[SafeText]: ...
|
def items_for_result(cl: ChangeList, result: Model, form: None) -> Iterator[SafeText]: ...
|
||||||
@@ -27,12 +27,12 @@ class ResultList(list):
|
|||||||
def results(cl: ChangeList) -> Iterator[ResultList]: ...
|
def results(cl: ChangeList) -> Iterator[ResultList]: ...
|
||||||
def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ...
|
def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ...
|
||||||
def result_list(
|
def result_list(
|
||||||
cl: ChangeList
|
cl: ChangeList,
|
||||||
) -> Dict[
|
) -> Dict[
|
||||||
str, Union[List[Dict[str, Optional[Union[int, str]]]], List[ResultList], List[BoundField], ChangeList, int]
|
str, Union[List[Dict[str, Optional[Union[int, str]]]], List[ResultList], List[BoundField], ChangeList, int]
|
||||||
]: ...
|
]: ...
|
||||||
def result_list_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
def result_list_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||||
def date_hierarchy(cl: ChangeList) -> Optional[Dict[str, Union[Dict[str, str], List[Dict[str, str]], bool]]]: ...
|
def date_hierarchy(cl: ChangeList) -> Optional[Dict[str, Any]]: ...
|
||||||
def date_hierarchy_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
def date_hierarchy_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||||
def search_form(cl: ChangeList) -> Dict[str, Union[bool, ChangeList, str]]: ...
|
def search_form(cl: ChangeList) -> Dict[str, Union[bool, ChangeList, str]]: ...
|
||||||
def search_form_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
def search_form_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from typing import Any, Optional
|
from typing import Any
|
||||||
|
|
||||||
from django.contrib.admin.helpers import InlineAdminForm
|
from django.contrib.admin.helpers import InlineAdminForm
|
||||||
from django.contrib.admin.templatetags.base import InclusionAdminNode
|
|
||||||
from django.template.base import Parser, Token
|
from django.template.base import Parser, Token
|
||||||
from django.template.context import Context, RequestContext
|
from django.template.context import Context, RequestContext
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Optional
|
from typing import Any
|
||||||
|
|
||||||
register: Any
|
register: Any
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable, Dict, List
|
||||||
|
|
||||||
from django.template.base import Parser, Token
|
from django.template.base import Parser, Token
|
||||||
from django.template.context import Context
|
from django.template.context import Context
|
||||||
|
|||||||
23
django-stubs/contrib/admin/tests.pyi
Normal file
23
django-stubs/contrib/admin/tests.pyi
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
from typing import Any, Callable
|
||||||
|
|
||||||
|
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
|
||||||
|
from django.test.selenium import SeleniumTestCase
|
||||||
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
|
||||||
|
class CSPMiddleware(MiddlewareMixin): ...
|
||||||
|
|
||||||
|
class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase):
|
||||||
|
def wait_until(self, callback: Callable, timeout: int = ...) -> None: ...
|
||||||
|
def wait_for_popup(self, num_windows: int = ..., timeout: int = ...) -> None: ...
|
||||||
|
def wait_for(self, css_selector: str, timeout: int = ...) -> None: ...
|
||||||
|
def wait_for_text(self, css_selector: str, text: str, timeout: int = ...) -> None: ...
|
||||||
|
def wait_for_value(self, css_selector: str, text: str, timeout: int = ...) -> None: ...
|
||||||
|
def wait_until_visible(self, css_selector: str, timeout: int = ...) -> None: ...
|
||||||
|
def wait_until_invisible(self, css_selector: str, timeout: int = ...) -> None: ...
|
||||||
|
def wait_page_loaded(self) -> None: ...
|
||||||
|
def admin_login(self, username: str, password: str, login_url: str = ...) -> None: ...
|
||||||
|
def get_css_value(self, selector: str, attribute: str) -> Any: ...
|
||||||
|
def get_select_option(self, selector: str, value: Any) -> Any: ...
|
||||||
|
def assertSelectOptions(self, selector: str, values: Any) -> None: ...
|
||||||
|
def assertSelectedOptions(self, selector: str, values: Any) -> None: ...
|
||||||
|
def has_css_class(self, selector: str, klass: str) -> bool: ...
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import collections
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
|
from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, Type, Union
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from django.contrib.admin.options import BaseModelAdmin
|
from django.contrib.admin.options import BaseModelAdmin
|
||||||
@@ -8,30 +9,23 @@ from django.contrib.auth.forms import AdminPasswordChangeForm
|
|||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.deletion import Collector
|
from django.db.models.deletion import Collector
|
||||||
from django.db.models.fields import Field
|
from django.db.models.fields.reverse_related import ManyToOneRel
|
||||||
from django.db.models.fields.mixins import FieldCacheMixin
|
|
||||||
from django.db.models.fields.reverse_related import ForeignObjectRel, ManyToOneRel, OneToOneRel
|
|
||||||
from django.db.models.options import Options
|
from django.db.models.options import Options
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.utils.safestring import SafeText
|
from django.forms.forms import BaseForm
|
||||||
|
|
||||||
|
from django.db.models.fields import Field, reverse_related
|
||||||
|
|
||||||
class FieldIsAForeignKeyColumnName(Exception): ...
|
class FieldIsAForeignKeyColumnName(Exception): ...
|
||||||
|
|
||||||
def lookup_needs_distinct(opts: Options, lookup_path: str) -> bool: ...
|
def lookup_needs_distinct(opts: Options, lookup_path: str) -> bool: ...
|
||||||
def prepare_lookup_value(key: str, value: Union[datetime, str]) -> Union[bool, datetime, str]: ...
|
def prepare_lookup_value(key: str, value: Union[datetime, str]) -> Union[bool, datetime, str]: ...
|
||||||
def quote(s: Union[int, str, UUID]) -> Union[int, str, UUID]: ...
|
def quote(s: Union[int, str, UUID]) -> str: ...
|
||||||
def unquote(s: str) -> str: ...
|
def unquote(s: str) -> str: ...
|
||||||
def flatten(
|
def flatten(fields: Any) -> List[Union[Callable, str]]: ...
|
||||||
fields: Union[List[Union[Callable, str]], List[Union[List[str], str]], List[Union[Tuple[str, str], str]], Tuple]
|
def flatten_fieldsets(fieldsets: Any) -> List[Union[Callable, str]]: ...
|
||||||
) -> List[Union[Callable, str]]: ...
|
|
||||||
def flatten_fieldsets(
|
|
||||||
fieldsets: Union[
|
|
||||||
List[Tuple[Optional[str], Dict[str, Tuple[str]]]],
|
|
||||||
Tuple[Tuple[Optional[str], Dict[str, Tuple[Union[Tuple[str, str], str]]]]],
|
|
||||||
]
|
|
||||||
) -> List[Union[Callable, str]]: ...
|
|
||||||
def get_deleted_objects(
|
def get_deleted_objects(
|
||||||
objs: QuerySet, request: WSGIRequest, admin_site: AdminSite
|
objs: Sequence[Optional[Model]], request: WSGIRequest, admin_site: AdminSite
|
||||||
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
||||||
|
|
||||||
class NestedObjects(Collector):
|
class NestedObjects(Collector):
|
||||||
@@ -45,36 +39,30 @@ class NestedObjects(Collector):
|
|||||||
model_objs: Any = ...
|
model_objs: Any = ...
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def add_edge(self, source: Optional[Model], target: Model) -> None: ...
|
def add_edge(self, source: Optional[Model], target: Model) -> None: ...
|
||||||
def collect(
|
def related_objects(self, related: ManyToOneRel, objs: Sequence[Optional[Model]]) -> QuerySet: ...
|
||||||
self,
|
def nested(self, format_callback: Callable = ...) -> List[Any]: ...
|
||||||
objs: Union[List[Model], QuerySet],
|
|
||||||
source: Optional[Type[Model]] = ...,
|
|
||||||
source_attr: Optional[str] = ...,
|
|
||||||
**kwargs: Any
|
|
||||||
) -> None: ...
|
|
||||||
def related_objects(self, related: ManyToOneRel, objs: List[Model]) -> QuerySet: ...
|
|
||||||
def nested(self, format_callback: Callable = ...) -> Union[List[SafeText], List[int]]: ...
|
|
||||||
def can_fast_delete(self, *args: Any, **kwargs: Any) -> bool: ...
|
|
||||||
|
|
||||||
def model_format_dict(obj: Any): ...
|
def model_format_dict(obj: Any): ...
|
||||||
def model_ngettext(obj: Union[Options, QuerySet], n: Optional[int] = ...) -> str: ...
|
def model_ngettext(obj: Union[Options, QuerySet], n: Optional[int] = ...) -> str: ...
|
||||||
def lookup_field(
|
def lookup_field(
|
||||||
name: Union[Callable, str], obj: Model, model_admin: BaseModelAdmin = ...
|
name: Union[Callable, str], obj: Model, model_admin: BaseModelAdmin = ...
|
||||||
) -> Tuple[Optional[Field], Callable, Callable]: ...
|
) -> Tuple[Optional[Field], Any, Any]: ...
|
||||||
def label_for_field(
|
def label_for_field(
|
||||||
name: Union[Callable, str], model: Type[Model], model_admin: Optional[BaseModelAdmin] = ..., return_attr: bool = ...
|
name: Union[Callable, str],
|
||||||
|
model: Type[Model],
|
||||||
|
model_admin: Optional[BaseModelAdmin] = ...,
|
||||||
|
return_attr: bool = ...,
|
||||||
|
form: Optional[BaseForm] = ...,
|
||||||
) -> Union[Tuple[Optional[str], Union[Callable, Type[str]]], str]: ...
|
) -> Union[Tuple[Optional[str], Union[Callable, Type[str]]], str]: ...
|
||||||
def help_text_for_field(name: str, model: Type[Model]) -> str: ...
|
def help_text_for_field(name: str, model: Type[Model]) -> str: ...
|
||||||
def display_for_field(
|
def display_for_field(value: Any, field: Field, empty_value_display: str) -> str: ...
|
||||||
value: Any, field: Union[Field, reverse_related.OneToOneRel], empty_value_display: str
|
|
||||||
) -> str: ...
|
|
||||||
def display_for_value(value: Any, empty_value_display: str, boolean: bool = ...) -> str: ...
|
def display_for_value(value: Any, empty_value_display: str, boolean: bool = ...) -> str: ...
|
||||||
|
|
||||||
class NotRelationField(Exception): ...
|
class NotRelationField(Exception): ...
|
||||||
|
|
||||||
def get_model_from_relation(field: Union[Field, reverse_related.ForeignObjectRel]) -> Type[Model]: ...
|
def get_model_from_relation(field: Union[Field, reverse_related.ForeignObjectRel]) -> Type[Model]: ...
|
||||||
def reverse_field_path(model: Type[Model], path: str) -> Tuple[Type[Model], str]: ...
|
def reverse_field_path(model: Type[Model], path: str) -> Tuple[Type[Model], str]: ...
|
||||||
def get_fields_from_path(model: Type[Model], path: str) -> List[Union[Field, FieldCacheMixin]]: ...
|
def get_fields_from_path(model: Type[Model], path: str) -> List[Field]: ...
|
||||||
def construct_change_message(
|
def construct_change_message(
|
||||||
form: AdminPasswordChangeForm, formsets: None, add: bool
|
form: AdminPasswordChangeForm, formsets: None, add: bool
|
||||||
) -> List[Dict[str, Dict[str, List[str]]]]: ...
|
) -> List[Dict[str, Dict[str, List[str]]]]: ...
|
||||||
|
|||||||
@@ -1,18 +1,10 @@
|
|||||||
from typing import Any, Optional
|
from typing import Any
|
||||||
|
|
||||||
|
from django.contrib.admin.options import ModelAdmin
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.core.paginator import Paginator
|
|
||||||
from django.db.models.query import QuerySet
|
|
||||||
from django.http.response import JsonResponse
|
|
||||||
from django.views.generic.list import BaseListView
|
from django.views.generic.list import BaseListView
|
||||||
|
|
||||||
class AutocompleteJsonView(BaseListView):
|
class AutocompleteJsonView(BaseListView):
|
||||||
paginate_by: int = ...
|
|
||||||
model_admin: ModelAdmin = ...
|
model_admin: ModelAdmin = ...
|
||||||
term: Any = ...
|
term: Any = ...
|
||||||
paginator_class: Any = ...
|
|
||||||
object_list: Any = ...
|
|
||||||
def get(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> JsonResponse: ...
|
|
||||||
def get_paginator(self, *args: Any, **kwargs: Any) -> Paginator: ...
|
|
||||||
def get_queryset(self) -> QuerySet: ...
|
|
||||||
def has_perm(self, request: WSGIRequest, obj: None = ...) -> bool: ...
|
def has_perm(self, request: WSGIRequest, obj: None = ...) -> bool: ...
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
from typing import Any, Callable, Optional
|
from typing import Callable, Optional, TypeVar, overload
|
||||||
|
|
||||||
|
_C = TypeVar("_C", bound=Callable)
|
||||||
|
@overload
|
||||||
def staff_member_required(
|
def staff_member_required(
|
||||||
view_func: Optional[Callable] = ..., redirect_field_name: str = ..., login_url: str = ...
|
view_func: _C = ..., redirect_field_name: Optional[str] = ..., login_url: str = ...
|
||||||
|
) -> _C: ...
|
||||||
|
@overload
|
||||||
|
def staff_member_required(
|
||||||
|
view_func: None = ..., redirect_field_name: Optional[str] = ..., login_url: str = ...
|
||||||
) -> Callable: ...
|
) -> Callable: ...
|
||||||
|
|||||||
@@ -2,13 +2,18 @@ from collections import OrderedDict
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||||
|
|
||||||
from django.contrib.admin.filters import ListFilter, SimpleListFilter
|
from django.contrib.admin.filters import ListFilter, SimpleListFilter
|
||||||
from django.contrib.admin.options import ModelAdmin
|
from django.contrib.admin.options import ( # noqa: F401
|
||||||
|
ModelAdmin,
|
||||||
|
IS_POPUP_VAR as IS_POPUP_VAR,
|
||||||
|
TO_FIELD_VAR as TO_FIELD_VAR,
|
||||||
|
)
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.expressions import Combinable, CombinedExpression, OrderBy
|
from django.db.models.expressions import Combinable, CombinedExpression, OrderBy
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
|
||||||
from django.db.models.options import Options
|
from django.db.models.options import Options
|
||||||
|
from django.forms.formsets import BaseFormSet
|
||||||
|
|
||||||
ALL_VAR: str
|
ALL_VAR: str
|
||||||
ORDER_VAR: str
|
ORDER_VAR: str
|
||||||
@@ -44,6 +49,7 @@ class ChangeList:
|
|||||||
queryset: Any = ...
|
queryset: Any = ...
|
||||||
title: Any = ...
|
title: Any = ...
|
||||||
pk_attname: Any = ...
|
pk_attname: Any = ...
|
||||||
|
formset: Optional[BaseFormSet]
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
request: WSGIRequest,
|
request: WSGIRequest,
|
||||||
@@ -75,9 +81,7 @@ class ChangeList:
|
|||||||
paginator: Any = ...
|
paginator: Any = ...
|
||||||
def get_results(self, request: WSGIRequest) -> None: ...
|
def get_results(self, request: WSGIRequest) -> None: ...
|
||||||
def get_ordering_field(self, field_name: Union[Callable, str]) -> Optional[Union[CombinedExpression, str]]: ...
|
def get_ordering_field(self, field_name: Union[Callable, str]) -> Optional[Union[CombinedExpression, str]]: ...
|
||||||
def get_ordering(
|
def get_ordering(self, request: WSGIRequest, queryset: QuerySet) -> List[Union[OrderBy, Combinable, str]]: ...
|
||||||
self, request: WSGIRequest, queryset: QuerySet
|
|
||||||
) -> Union[List[Union[Combinable, str]], List[Union[OrderBy, str]]]: ...
|
|
||||||
def get_ordering_field_columns(self) -> OrderedDict: ...
|
def get_ordering_field_columns(self) -> OrderedDict: ...
|
||||||
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
|
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
|
||||||
def apply_select_related(self, qs: QuerySet) -> QuerySet: ...
|
def apply_select_related(self, qs: QuerySet) -> QuerySet: ...
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
from collections import OrderedDict
|
from typing import Any, Dict, Optional, Tuple, Union
|
||||||
from datetime import datetime
|
|
||||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
|
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from django import forms
|
|
||||||
from django.contrib.admin.sites import AdminSite
|
from django.contrib.admin.sites import AdminSite
|
||||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
from django.db.models.fields.reverse_related import ForeignObjectRel, ManyToOneRel
|
||||||
from django.db.models.query_utils import Q
|
from django.forms.models import ModelChoiceIterator
|
||||||
from django.forms.fields import Field
|
from django.forms.widgets import Media
|
||||||
from django.forms.widgets import ChoiceWidget, Media, Widget
|
|
||||||
from django.http.request import QueryDict
|
from django import forms
|
||||||
from django.utils.datastructures import MultiValueDict
|
|
||||||
|
|
||||||
class FilteredSelectMultiple(forms.SelectMultiple):
|
class FilteredSelectMultiple(forms.SelectMultiple):
|
||||||
@property
|
@property
|
||||||
@@ -18,112 +14,37 @@ class FilteredSelectMultiple(forms.SelectMultiple):
|
|||||||
verbose_name: Any = ...
|
verbose_name: Any = ...
|
||||||
is_stacked: Any = ...
|
is_stacked: Any = ...
|
||||||
def __init__(self, verbose_name: str, is_stacked: bool, attrs: None = ..., choices: Tuple = ...) -> None: ...
|
def __init__(self, verbose_name: str, is_stacked: bool, attrs: None = ..., choices: Tuple = ...) -> None: ...
|
||||||
def get_context(
|
|
||||||
self, name: str, value: Union[List[Any], str], attrs: Optional[Dict[str, str]]
|
|
||||||
) -> Dict[
|
|
||||||
str,
|
|
||||||
Union[
|
|
||||||
Dict[
|
|
||||||
str,
|
|
||||||
Union[
|
|
||||||
Dict[str, Union[int, str]],
|
|
||||||
List[Tuple[None, List[Dict[str, Union[Dict[Any, Any], int, str]]], int]],
|
|
||||||
bool,
|
|
||||||
str,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
Dict[str, Union[Dict[str, Union[int, str]], List[str], bool, str]],
|
|
||||||
],
|
|
||||||
]: ...
|
|
||||||
|
|
||||||
class AdminDateWidget(forms.DateInput):
|
class AdminDateWidget(forms.DateInput):
|
||||||
attrs: Dict[str, str]
|
|
||||||
input_type: str
|
|
||||||
@property
|
@property
|
||||||
def media(self) -> Media: ...
|
def media(self) -> Media: ...
|
||||||
def __init__(self, attrs: Optional[Dict[str, Union[int, str]]] = ..., format: None = ...) -> None: ...
|
|
||||||
|
|
||||||
class AdminTimeWidget(forms.TimeInput):
|
class AdminTimeWidget(forms.TimeInput):
|
||||||
attrs: Dict[str, str]
|
|
||||||
input_type: str
|
|
||||||
@property
|
@property
|
||||||
def media(self) -> Media: ...
|
def media(self) -> Media: ...
|
||||||
def __init__(self, attrs: Optional[Dict[str, Union[int, str]]] = ..., format: None = ...) -> None: ...
|
|
||||||
|
|
||||||
class AdminSplitDateTime(forms.SplitDateTimeWidget):
|
class AdminSplitDateTime(forms.SplitDateTimeWidget): ...
|
||||||
attrs: Dict[Any, Any]
|
class AdminRadioSelect(forms.RadioSelect): ...
|
||||||
widgets: List[DateTimeBaseInput]
|
class AdminFileWidget(forms.ClearableFileInput): ...
|
||||||
template_name: str = ...
|
|
||||||
def __init__(self, attrs: None = ...) -> None: ...
|
|
||||||
def get_context(
|
|
||||||
self, name: str, value: Optional[Union[List[str], datetime]], attrs: Optional[Dict[str, Union[bool, str]]]
|
|
||||||
) -> Dict[
|
|
||||||
str,
|
|
||||||
Union[
|
|
||||||
Dict[
|
|
||||||
str,
|
|
||||||
Optional[
|
|
||||||
Union[
|
|
||||||
Dict[str, Union[bool, str]],
|
|
||||||
List[Dict[str, Optional[Union[Dict[str, Union[bool, str]], bool, str]]]],
|
|
||||||
bool,
|
|
||||||
str,
|
|
||||||
]
|
|
||||||
],
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
],
|
|
||||||
]: ...
|
|
||||||
|
|
||||||
class AdminRadioSelect(forms.RadioSelect):
|
def url_params_from_lookup_dict(lookups: Any) -> Dict[str, str]: ...
|
||||||
attrs: Dict[str, str]
|
|
||||||
template_name: str = ...
|
|
||||||
|
|
||||||
class AdminFileWidget(forms.ClearableFileInput):
|
|
||||||
attrs: Dict[Any, Any]
|
|
||||||
template_name: str = ...
|
|
||||||
|
|
||||||
def url_params_from_lookup_dict(
|
|
||||||
lookups: Union[
|
|
||||||
Dict[str, Callable], Dict[str, List[str]], Dict[str, Tuple[str, str]], Dict[str, bool], Dict[str, str], Q
|
|
||||||
]
|
|
||||||
) -> Dict[str, str]: ...
|
|
||||||
|
|
||||||
class ForeignKeyRawIdWidget(forms.TextInput):
|
class ForeignKeyRawIdWidget(forms.TextInput):
|
||||||
attrs: Dict[Any, Any]
|
rel: ManyToOneRel = ...
|
||||||
template_name: str = ...
|
|
||||||
rel: django.db.models.fields.reverse_related.ManyToOneRel = ...
|
|
||||||
admin_site: AdminSite = ...
|
admin_site: AdminSite = ...
|
||||||
db: None = ...
|
db: None = ...
|
||||||
def __init__(self, rel: ForeignObjectRel, admin_site: AdminSite, attrs: None = ..., using: None = ...) -> None: ...
|
def __init__(self, rel: ForeignObjectRel, admin_site: AdminSite, attrs: None = ..., using: None = ...) -> None: ...
|
||||||
def get_context(
|
|
||||||
self, name: str, value: Optional[Union[List[int], int, str, UUID]], attrs: Optional[Dict[str, Union[bool, str]]]
|
|
||||||
) -> Dict[str, Union[Dict[str, Optional[Union[Dict[str, Union[bool, str]], bool, str]]], str]]: ...
|
|
||||||
def base_url_parameters(self) -> Dict[str, str]: ...
|
def base_url_parameters(self) -> Dict[str, str]: ...
|
||||||
def url_parameters(self) -> Dict[str, str]: ...
|
def url_parameters(self) -> Dict[str, str]: ...
|
||||||
def label_and_url_for_value(self, value: Union[int, str, UUID]) -> Tuple[str, str]: ...
|
def label_and_url_for_value(self, value: Union[int, str, UUID]) -> Tuple[str, str]: ...
|
||||||
|
|
||||||
class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
|
class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): ...
|
||||||
admin_site: AdminSite
|
|
||||||
attrs: Dict[Any, Any]
|
|
||||||
db: None
|
|
||||||
rel: django.db.models.fields.reverse_related.ManyToManyRel
|
|
||||||
template_name: str = ...
|
|
||||||
def get_context(
|
|
||||||
self, name: str, value: Optional[List[int]], attrs: Optional[Dict[str, str]]
|
|
||||||
) -> Dict[str, Union[Dict[str, Union[Dict[str, str], bool, str]], str]]: ...
|
|
||||||
def url_parameters(self) -> Dict[Any, Any]: ...
|
|
||||||
def label_and_url_for_value(self, value: List[int]) -> Tuple[str, str]: ...
|
|
||||||
def value_from_datadict(self, data: QueryDict, files: MultiValueDict, name: str) -> None: ...
|
|
||||||
def format_value(self, value: Optional[List[int]]) -> str: ...
|
|
||||||
|
|
||||||
class RelatedFieldWidgetWrapper(forms.Widget):
|
class RelatedFieldWidgetWrapper(forms.Widget):
|
||||||
template_name: str = ...
|
template_name: str = ...
|
||||||
needs_multipart_form: bool = ...
|
|
||||||
attrs: Dict[Any, Any] = ...
|
|
||||||
choices: ModelChoiceIterator = ...
|
choices: ModelChoiceIterator = ...
|
||||||
widget: django.contrib.admin.widgets.AutocompleteSelect = ...
|
widget: forms.Widget = ...
|
||||||
rel: django.db.models.fields.reverse_related.ManyToOneRel = ...
|
rel: ManyToOneRel = ...
|
||||||
can_add_related: bool = ...
|
can_add_related: bool = ...
|
||||||
can_change_related: bool = ...
|
can_change_related: bool = ...
|
||||||
can_delete_related: bool = ...
|
can_delete_related: bool = ...
|
||||||
@@ -131,7 +52,7 @@ class RelatedFieldWidgetWrapper(forms.Widget):
|
|||||||
admin_site: AdminSite = ...
|
admin_site: AdminSite = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
widget: ChoiceWidget,
|
widget: forms.Widget,
|
||||||
rel: ForeignObjectRel,
|
rel: ForeignObjectRel,
|
||||||
admin_site: AdminSite,
|
admin_site: AdminSite,
|
||||||
can_add_related: Optional[bool] = ...,
|
can_add_related: Optional[bool] = ...,
|
||||||
@@ -139,54 +60,22 @@ class RelatedFieldWidgetWrapper(forms.Widget):
|
|||||||
can_delete_related: bool = ...,
|
can_delete_related: bool = ...,
|
||||||
can_view_related: bool = ...,
|
can_view_related: bool = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __deepcopy__(
|
|
||||||
self, memo: Dict[int, Union[List[Union[Field, Widget]], OrderedDict, Field, Widget]]
|
|
||||||
) -> RelatedFieldWidgetWrapper: ...
|
|
||||||
@property
|
|
||||||
def is_hidden(self) -> bool: ...
|
|
||||||
@property
|
@property
|
||||||
def media(self) -> Media: ...
|
def media(self) -> Media: ...
|
||||||
def get_related_url(self, info: Tuple[str, str], action: str, *args: Any) -> str: ...
|
def get_related_url(self, info: Tuple[str, str], action: str, *args: Any) -> str: ...
|
||||||
def get_context(
|
|
||||||
self, name: str, value: Optional[Union[int, str]], attrs: Optional[Dict[str, Union[bool, str]]]
|
|
||||||
) -> Dict[str, Union[bool, str]]: ...
|
|
||||||
def value_from_datadict(
|
|
||||||
self, data: QueryDict, files: MultiValueDict, name: str
|
|
||||||
) -> Optional[Union[List[str], str]]: ...
|
|
||||||
def value_omitted_from_data(self, data: Dict[Any, Any], files: Dict[Any, Any], name: str) -> bool: ...
|
|
||||||
def id_for_label(self, id_: str) -> str: ...
|
|
||||||
|
|
||||||
class AdminTextareaWidget(forms.Textarea):
|
class AdminTextareaWidget(forms.Textarea): ...
|
||||||
attrs: Dict[str, str]
|
class AdminTextInputWidget(forms.TextInput): ...
|
||||||
def __init__(self, attrs: None = ...) -> None: ...
|
class AdminEmailInputWidget(forms.EmailInput): ...
|
||||||
|
class AdminURLFieldWidget(forms.URLInput): ...
|
||||||
class AdminTextInputWidget(forms.TextInput):
|
|
||||||
attrs: Dict[str, str]
|
|
||||||
input_type: str
|
|
||||||
def __init__(self, attrs: None = ...) -> None: ...
|
|
||||||
|
|
||||||
class AdminEmailInputWidget(forms.EmailInput):
|
|
||||||
attrs: Dict[str, str]
|
|
||||||
input_type: str
|
|
||||||
def __init__(self, attrs: None = ...) -> None: ...
|
|
||||||
|
|
||||||
class AdminURLFieldWidget(forms.URLInput):
|
|
||||||
attrs: Dict[str, str]
|
|
||||||
input_type: str
|
|
||||||
template_name: str = ...
|
|
||||||
def __init__(self, attrs: None = ...) -> None: ...
|
|
||||||
def get_context(
|
|
||||||
self, name: str, value: Optional[str], attrs: Optional[Dict[str, str]]
|
|
||||||
) -> Dict[str, Union[Dict[str, Optional[Union[Dict[str, str], bool, str]]], str]]: ...
|
|
||||||
|
|
||||||
class AdminIntegerFieldWidget(forms.NumberInput):
|
class AdminIntegerFieldWidget(forms.NumberInput):
|
||||||
attrs: Dict[str, str]
|
|
||||||
input_type: str
|
|
||||||
class_name: str = ...
|
class_name: str = ...
|
||||||
def __init__(self, attrs: None = ...) -> None: ...
|
|
||||||
|
|
||||||
class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget):
|
class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget): ...
|
||||||
class_name: str = ...
|
|
||||||
|
class AdminUUIDInputWidget(forms.TextInput):
|
||||||
|
def __init__(self, attrs: Optional[Dict[str, str]] = ...) -> None: ...
|
||||||
|
|
||||||
SELECT2_TRANSLATIONS: Any
|
SELECT2_TRANSLATIONS: Any
|
||||||
|
|
||||||
@@ -206,12 +95,6 @@ class AutocompleteMixin:
|
|||||||
using: None = ...,
|
using: None = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def get_url(self) -> str: ...
|
def get_url(self) -> str: ...
|
||||||
def build_attrs(
|
|
||||||
self, base_attrs: Dict[str, str], extra_attrs: Optional[Dict[str, Union[bool, str]]] = ...
|
|
||||||
) -> Dict[str, Union[bool, str]]: ...
|
|
||||||
def optgroups(
|
|
||||||
self, name: str, value: List[str], attr: Dict[str, Union[bool, str]] = ...
|
|
||||||
) -> List[Tuple[None, List[Dict[str, Union[Dict[str, bool], Set[str], int, str]]], int]]: ...
|
|
||||||
@property
|
@property
|
||||||
def media(self) -> Media: ...
|
def media(self) -> Media: ...
|
||||||
|
|
||||||
|
|||||||
6
django-stubs/contrib/admindocs/apps.pyi
Normal file
6
django-stubs/contrib/admindocs/apps.pyi
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig as AppConfig
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class AdminDocsConfig(AppConfig):
|
||||||
|
name: str = ...
|
||||||
|
verbose_name: Any = ...
|
||||||
3
django-stubs/contrib/admindocs/urls.pyi
Normal file
3
django-stubs/contrib/admindocs/urls.pyi
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from typing import Any, List
|
||||||
|
|
||||||
|
urlpatterns: List[Any] = ...
|
||||||
@@ -3,46 +3,17 @@ from typing import Any, Optional, Union
|
|||||||
from django.db.models.fields import Field
|
from django.db.models.fields import Field
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
from .utils import get_view_name
|
|
||||||
|
|
||||||
MODEL_METHODS_EXCLUDE: Any
|
MODEL_METHODS_EXCLUDE: Any
|
||||||
|
|
||||||
class BaseAdminDocsView(TemplateView):
|
class BaseAdminDocsView(TemplateView): ...
|
||||||
template_name: str = ...
|
class BookmarkletsView(BaseAdminDocsView): ...
|
||||||
def dispatch(self, request: Any, *args: Any, **kwargs: Any): ...
|
class TemplateTagIndexView(BaseAdminDocsView): ...
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
class TemplateFilterIndexView(BaseAdminDocsView): ...
|
||||||
|
class ViewIndexView(BaseAdminDocsView): ...
|
||||||
class BookmarkletsView(BaseAdminDocsView):
|
class ViewDetailView(BaseAdminDocsView): ...
|
||||||
template_name: str = ...
|
class ModelIndexView(BaseAdminDocsView): ...
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
class ModelDetailView(BaseAdminDocsView): ...
|
||||||
|
class TemplateDetailView(BaseAdminDocsView): ...
|
||||||
class TemplateTagIndexView(BaseAdminDocsView):
|
|
||||||
template_name: str = ...
|
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
|
||||||
|
|
||||||
class TemplateFilterIndexView(BaseAdminDocsView):
|
|
||||||
template_name: str = ...
|
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
|
||||||
|
|
||||||
class ViewIndexView(BaseAdminDocsView):
|
|
||||||
template_name: str = ...
|
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
|
||||||
|
|
||||||
class ViewDetailView(BaseAdminDocsView):
|
|
||||||
template_name: str = ...
|
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
|
||||||
|
|
||||||
class ModelIndexView(BaseAdminDocsView):
|
|
||||||
template_name: str = ...
|
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
|
||||||
|
|
||||||
class ModelDetailView(BaseAdminDocsView):
|
|
||||||
template_name: str = ...
|
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
|
||||||
|
|
||||||
class TemplateDetailView(BaseAdminDocsView):
|
|
||||||
template_name: str = ...
|
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
|
||||||
|
|
||||||
def get_return_data_type(func_name: Any): ...
|
def get_return_data_type(func_name: Any): ...
|
||||||
def get_readable_field_data_type(field: Union[Field, str]) -> str: ...
|
def get_readable_field_data_type(field: Union[Field, str]) -> str: ...
|
||||||
|
|||||||
@@ -2,13 +2,16 @@ from typing import Any, List, Optional, Type, Union
|
|||||||
|
|
||||||
from django.contrib.auth.backends import ModelBackend
|
from django.contrib.auth.backends import ModelBackend
|
||||||
from django.contrib.auth.base_user import AbstractBaseUser
|
from django.contrib.auth.base_user import AbstractBaseUser
|
||||||
from django.contrib.auth.models import AbstractUser, AnonymousUser
|
from django.contrib.auth.models import AnonymousUser
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.options import Options
|
from django.db.models.options import Options
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
|
from django.test.client import Client
|
||||||
|
|
||||||
from .signals import user_logged_in, user_logged_out, user_login_failed
|
from .signals import user_logged_in as user_logged_in
|
||||||
|
from .signals import user_logged_out as user_logged_out
|
||||||
|
from .signals import user_login_failed as user_login_failed
|
||||||
|
|
||||||
SESSION_KEY: str
|
SESSION_KEY: str
|
||||||
BACKEND_SESSION_KEY: str
|
BACKEND_SESSION_KEY: str
|
||||||
@@ -19,12 +22,12 @@ def load_backend(path: str) -> ModelBackend: ...
|
|||||||
def get_backends() -> List[ModelBackend]: ...
|
def get_backends() -> List[ModelBackend]: ...
|
||||||
def authenticate(request: Any = ..., **credentials: Any) -> Optional[AbstractBaseUser]: ...
|
def authenticate(request: Any = ..., **credentials: Any) -> Optional[AbstractBaseUser]: ...
|
||||||
def login(
|
def login(
|
||||||
request: HttpRequest, user: AbstractBaseUser, backend: Optional[Union[Type[ModelBackend], str]] = ...
|
request: HttpRequest, user: Optional[AbstractBaseUser], backend: Optional[Union[Type[ModelBackend], str]] = ...
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def logout(request: HttpRequest) -> None: ...
|
def logout(request: HttpRequest) -> None: ...
|
||||||
def get_user_model() -> Type[Model]: ...
|
def get_user_model() -> Type[Model]: ...
|
||||||
def get_user(request: HttpRequest) -> Union[AbstractBaseUser, AnonymousUser]: ...
|
def get_user(request: Union[HttpRequest, Client]) -> Union[AbstractBaseUser, AnonymousUser]: ...
|
||||||
def get_permission_codename(action: str, opts: Options) -> str: ...
|
def get_permission_codename(action: str, opts: Options) -> str: ...
|
||||||
def update_session_auth_hash(request: WSGIRequest, user: AbstractUser) -> None: ...
|
def update_session_auth_hash(request: HttpRequest, user: AbstractBaseUser) -> None: ...
|
||||||
|
|
||||||
default_app_config: str
|
default_app_config: str
|
||||||
|
|||||||
@@ -1,54 +1,18 @@
|
|||||||
from typing import Any, Dict, List, Optional, Tuple, Type
|
from typing import Any
|
||||||
|
|
||||||
from django.contrib.auth.models import User, Group
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.db.models.fields.related import ManyToManyField
|
|
||||||
from django.forms.models import ModelMultipleChoiceField
|
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
from django.urls.resolvers import URLPattern
|
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.admin.sites import AdminSite
|
|
||||||
|
|
||||||
csrf_protect_m: Any
|
csrf_protect_m: Any
|
||||||
sensitive_post_parameters_m: Any
|
sensitive_post_parameters_m: Any
|
||||||
|
|
||||||
class GroupAdmin(admin.ModelAdmin):
|
class GroupAdmin(admin.ModelAdmin): ...
|
||||||
admin_site: AdminSite
|
|
||||||
formfield_overrides: Any
|
|
||||||
model: Type[Group]
|
|
||||||
opts: Options
|
|
||||||
search_fields: Any = ...
|
|
||||||
ordering: Any = ...
|
|
||||||
filter_horizontal: Any = ...
|
|
||||||
def formfield_for_manytomany(
|
|
||||||
self, db_field: ManyToManyField, request: WSGIRequest = ..., **kwargs: Any
|
|
||||||
) -> ModelMultipleChoiceField: ...
|
|
||||||
|
|
||||||
class UserAdmin(admin.ModelAdmin):
|
class UserAdmin(admin.ModelAdmin):
|
||||||
admin_site: AdminSite
|
|
||||||
formfield_overrides: Dict[
|
|
||||||
Type[Union[django.db.models.fields.DateTimeCheckMixin, Field]],
|
|
||||||
Dict[str, Type[Union[django.forms.fields.SplitDateTimeField, Widget]]],
|
|
||||||
]
|
|
||||||
model: Type[User]
|
|
||||||
opts: Options
|
|
||||||
add_form_template: str = ...
|
|
||||||
change_user_password_template: Any = ...
|
change_user_password_template: Any = ...
|
||||||
fieldsets: Any = ...
|
|
||||||
add_fieldsets: Any = ...
|
add_fieldsets: Any = ...
|
||||||
form: Any = ...
|
|
||||||
add_form: Any = ...
|
add_form: Any = ...
|
||||||
change_password_form: Any = ...
|
change_password_form: Any = ...
|
||||||
list_display: Any = ...
|
|
||||||
list_filter: Any = ...
|
|
||||||
search_fields: Any = ...
|
|
||||||
ordering: Any = ...
|
|
||||||
filter_horizontal: Any = ...
|
|
||||||
def get_fieldsets(self, request: WSGIRequest, obj: None = ...) -> Tuple[Tuple[None, Dict[str, Tuple[str]]]]: ...
|
|
||||||
def get_form(self, request: Any, obj: Optional[Any] = ..., **kwargs: Any): ...
|
|
||||||
def get_urls(self) -> List[URLPattern]: ...
|
|
||||||
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
|
|
||||||
def add_view(self, request: WSGIRequest, form_url: str = ..., extra_context: None = ...) -> Any: ...
|
|
||||||
def user_change_password(self, request: WSGIRequest, id: str, form_url: str = ...) -> HttpResponse: ...
|
def user_change_password(self, request: WSGIRequest, id: str, form_url: str = ...) -> HttpResponse: ...
|
||||||
def response_add(self, request: WSGIRequest, obj: User, post_url_continue: None = ...) -> HttpResponse: ...
|
|
||||||
|
|||||||
@@ -1,18 +1,3 @@
|
|||||||
from typing import Any, Optional
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
from .checks import check_models_permissions, check_user_model
|
class AuthConfig(AppConfig): ...
|
||||||
from .management import create_permissions
|
|
||||||
from .signals import user_logged_in
|
|
||||||
|
|
||||||
class AuthConfig(AppConfig):
|
|
||||||
apps: None
|
|
||||||
label: str
|
|
||||||
models: None
|
|
||||||
models_module: None
|
|
||||||
module: Any
|
|
||||||
path: str
|
|
||||||
name: str = ...
|
|
||||||
verbose_name: Any = ...
|
|
||||||
def ready(self) -> None: ...
|
|
||||||
|
|||||||
@@ -1,29 +1,41 @@
|
|||||||
from typing import Any, Optional, Set, Union
|
from typing import Any, Optional, Set, Union
|
||||||
|
|
||||||
from django.contrib.auth.base_user import AbstractBaseUser
|
from django.contrib.auth.base_user import AbstractBaseUser
|
||||||
from django.contrib.auth.models import AnonymousUser, User
|
from django.contrib.auth.models import AnonymousUser, User, Permission
|
||||||
|
|
||||||
|
from django.db.models.base import Model
|
||||||
|
from django.http.request import HttpRequest
|
||||||
|
|
||||||
|
_AnyUser = Union[Model, AnonymousUser]
|
||||||
|
|
||||||
UserModel: Any
|
UserModel: Any
|
||||||
|
|
||||||
class ModelBackend:
|
class BaseBackend:
|
||||||
def authenticate(
|
def authenticate(
|
||||||
self, request: Any, username: Optional[Union[int, str]] = ..., password: Optional[str] = ..., **kwargs: Any
|
self, request: HttpRequest, username: Optional[str] = ..., password: Optional[str] = ..., **kwargs: Any
|
||||||
) -> Optional[AbstractBaseUser]: ...
|
) -> Optional[AbstractBaseUser]: ...
|
||||||
def user_can_authenticate(self, user: Optional[AbstractBaseUser]) -> bool: ...
|
def get_user(self, user_id: int) -> Optional[AbstractBaseUser]: ...
|
||||||
def get_user_permissions(self, user_obj: AbstractBaseUser, obj: None = ...) -> Set[str]: ...
|
def get_user_permissions(self, user_obj: _AnyUser, obj: Optional[Model] = ...) -> Set[str]: ...
|
||||||
def get_group_permissions(self, user_obj: AbstractBaseUser, obj: None = ...) -> Set[str]: ...
|
def get_group_permissions(self, user_obj: _AnyUser, obj: Optional[Model] = ...) -> Set[str]: ...
|
||||||
def get_all_permissions(self, user_obj: AbstractBaseUser, obj: Optional[str] = ...) -> Set[str]: ...
|
def get_all_permissions(self, user_obj: _AnyUser, obj: Optional[Model] = ...) -> Set[str]: ...
|
||||||
def has_perm(
|
def has_perm(self, user_obj: _AnyUser, perm: str, obj: Optional[Model] = ...) -> bool: ...
|
||||||
self, user_obj: Union[AbstractBaseUser, AnonymousUser], perm: str, obj: Optional[str] = ...
|
|
||||||
) -> bool: ...
|
class ModelBackend(BaseBackend):
|
||||||
def has_module_perms(self, user_obj: Union[AbstractBaseUser, AnonymousUser], app_label: str) -> bool: ...
|
def has_module_perms(self, user_obj: _AnyUser, app_label: str) -> bool: ...
|
||||||
def get_user(self, user_id: int) -> AbstractBaseUser: ...
|
def user_can_authenticate(self, user: Optional[_AnyUser]) -> bool: ...
|
||||||
|
def with_perm(
|
||||||
|
self,
|
||||||
|
perm: Union[str, Permission],
|
||||||
|
is_active: bool = ...,
|
||||||
|
include_superusers: bool = ...,
|
||||||
|
obj: Optional[Model] = ...,
|
||||||
|
): ...
|
||||||
|
|
||||||
class AllowAllUsersModelBackend(ModelBackend): ...
|
class AllowAllUsersModelBackend(ModelBackend): ...
|
||||||
|
|
||||||
class RemoteUserBackend(ModelBackend):
|
class RemoteUserBackend(ModelBackend):
|
||||||
create_unknown_user: bool = ...
|
create_unknown_user: bool = ...
|
||||||
def clean_username(self, username: str) -> str: ...
|
def clean_username(self, username: str) -> str: ...
|
||||||
def configure_user(self, user: User) -> User: ...
|
def configure_user(self, request: HttpRequest, user: User) -> User: ...
|
||||||
|
|
||||||
class AllowAllUsersRemoteUserBackend(RemoteUserBackend): ...
|
class AllowAllUsersRemoteUserBackend(RemoteUserBackend): ...
|
||||||
|
|||||||
@@ -1,29 +1,37 @@
|
|||||||
from typing import Any, Optional, Tuple, List
|
import sys
|
||||||
|
from typing import Any, Optional, Tuple, List, overload, TypeVar, Union
|
||||||
|
|
||||||
|
from django.db.models.base import Model
|
||||||
|
from django.db.models.expressions import Combinable
|
||||||
|
from django.db.models.fields import BooleanField
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
class BaseUserManager(models.Manager):
|
if sys.version_info < (3, 8):
|
||||||
|
from typing_extensions import Literal
|
||||||
|
else:
|
||||||
|
from typing import Literal
|
||||||
|
|
||||||
|
_T = TypeVar("_T", bound=Model)
|
||||||
|
|
||||||
|
class BaseUserManager(models.Manager[_T]):
|
||||||
@classmethod
|
@classmethod
|
||||||
def normalize_email(cls, email: Optional[str]) -> str: ...
|
def normalize_email(cls, email: Optional[str]) -> str: ...
|
||||||
def make_random_password(self, length: int = ..., allowed_chars: str = ...) -> str: ...
|
def make_random_password(self, length: int = ..., allowed_chars: str = ...) -> str: ...
|
||||||
def get_by_natural_key(self, username: Optional[str]) -> AbstractBaseUser: ...
|
def get_by_natural_key(self, username: Optional[str]) -> _T: ...
|
||||||
|
|
||||||
class AbstractBaseUser(models.Model):
|
class AbstractBaseUser(models.Model):
|
||||||
password: models.CharField = ...
|
|
||||||
last_login: Optional[models.DateTimeField] = ...
|
|
||||||
is_active: bool = ...
|
|
||||||
REQUIRED_FIELDS: List[str] = ...
|
REQUIRED_FIELDS: List[str] = ...
|
||||||
class Meta:
|
|
||||||
abstract: bool = ...
|
password = models.CharField(max_length=128)
|
||||||
|
last_login = models.DateTimeField(blank=True, null=True)
|
||||||
|
is_active: Union[bool, BooleanField[Union[bool, Combinable], bool]] = ...
|
||||||
def get_username(self) -> str: ...
|
def get_username(self) -> str: ...
|
||||||
def clean(self) -> None: ...
|
|
||||||
def save(self, *args: Any, **kwargs: Any) -> None: ...
|
|
||||||
def natural_key(self) -> Tuple[str]: ...
|
def natural_key(self) -> Tuple[str]: ...
|
||||||
@property
|
@property
|
||||||
def is_anonymous(self) -> bool: ...
|
def is_anonymous(self) -> Literal[False]: ...
|
||||||
@property
|
@property
|
||||||
def is_authenticated(self) -> bool: ...
|
def is_authenticated(self) -> Literal[True]: ...
|
||||||
def set_password(self, raw_password: Optional[str]) -> None: ...
|
def set_password(self, raw_password: str) -> None: ...
|
||||||
def check_password(self, raw_password: str) -> bool: ...
|
def check_password(self, raw_password: str) -> bool: ...
|
||||||
def set_unusable_password(self) -> None: ...
|
def set_unusable_password(self) -> None: ...
|
||||||
def has_usable_password(self) -> bool: ...
|
def has_usable_password(self) -> bool: ...
|
||||||
@@ -31,4 +39,8 @@ class AbstractBaseUser(models.Model):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_email_field_name(cls) -> str: ...
|
def get_email_field_name(cls) -> str: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@overload
|
||||||
def normalize_username(cls, username: str) -> str: ...
|
def normalize_username(cls, username: str) -> str: ...
|
||||||
|
@classmethod
|
||||||
|
@overload
|
||||||
|
def normalize_username(cls, username: Any) -> Any: ...
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
from typing import Any, List, Optional
|
from typing import Any, List, Optional, Sequence
|
||||||
|
|
||||||
from django.core.checks.messages import CheckMessage
|
from django.core.checks.messages import CheckMessage
|
||||||
|
|
||||||
from .management import _get_builtin_permissions
|
from django.apps.config import AppConfig
|
||||||
|
|
||||||
def check_user_model(app_configs: None = ..., **kwargs: Any) -> List[CheckMessage]: ...
|
def check_user_model(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[CheckMessage]: ...
|
||||||
def check_models_permissions(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
def check_models_permissions(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Any]: ...
|
||||||
|
|||||||
@@ -1,22 +1,20 @@
|
|||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any, Dict
|
||||||
|
|
||||||
from django.contrib.auth.models import AnonymousUser, User
|
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.utils.functional import SimpleLazyObject
|
|
||||||
|
|
||||||
class PermLookupDict:
|
class PermLookupDict:
|
||||||
app_label: django.utils.safestring.SafeText
|
app_label: str
|
||||||
user: SimpleLazyObject
|
user: Any
|
||||||
def __init__(self, user: SimpleLazyObject, app_label: str) -> None: ...
|
def __init__(self, user: Any, app_label: str) -> None: ...
|
||||||
def __getitem__(self, perm_name: str) -> bool: ...
|
def __getitem__(self, perm_name: str) -> bool: ...
|
||||||
def __iter__(self) -> Any: ...
|
def __iter__(self) -> Any: ...
|
||||||
def __bool__(self) -> bool: ...
|
def __bool__(self) -> bool: ...
|
||||||
|
|
||||||
class PermWrapper:
|
class PermWrapper:
|
||||||
user: SimpleLazyObject = ...
|
user: Any = ...
|
||||||
def __init__(self, user: Union[AnonymousUser, User]) -> None: ...
|
def __init__(self, user: Any) -> None: ...
|
||||||
def __getitem__(self, app_label: str) -> PermLookupDict: ...
|
def __getitem__(self, app_label: str) -> PermLookupDict: ...
|
||||||
def __iter__(self) -> Any: ...
|
def __iter__(self) -> Any: ...
|
||||||
def __contains__(self, perm_name: Union[bool, str]) -> bool: ...
|
def __contains__(self, perm_name: Any) -> bool: ...
|
||||||
|
|
||||||
def auth(request: HttpRequest) -> Dict[str, Union[PermWrapper, AnonymousUser, User]]: ...
|
def auth(request: HttpRequest) -> Dict[str, Any]: ...
|
||||||
|
|||||||
@@ -1,11 +1,21 @@
|
|||||||
from typing import Any, Callable, List, Optional, Set, Union
|
from typing import Callable, List, Optional, Set, Union, TypeVar, overload
|
||||||
|
|
||||||
|
from django.contrib.auth import REDIRECT_FIELD_NAME as REDIRECT_FIELD_NAME # noqa: F401
|
||||||
|
from django.http.response import HttpResponseBase
|
||||||
|
|
||||||
|
from django.contrib.auth.models import AbstractUser
|
||||||
|
|
||||||
|
_VIEW = TypeVar("_VIEW", bound=Callable[..., HttpResponseBase])
|
||||||
|
|
||||||
def user_passes_test(
|
def user_passes_test(
|
||||||
test_func: Callable, login_url: Optional[str] = ..., redirect_field_name: str = ...
|
test_func: Callable[[AbstractUser], bool], login_url: Optional[str] = ..., redirect_field_name: str = ...
|
||||||
) -> Callable: ...
|
) -> Callable[[_VIEW], _VIEW]: ...
|
||||||
def login_required(
|
|
||||||
function: Optional[Callable] = ..., redirect_field_name: str = ..., login_url: Optional[str] = ...
|
# There are two ways of calling @login_required: @with(arguments) and @bare
|
||||||
) -> Callable: ...
|
@overload
|
||||||
|
def login_required(redirect_field_name: str = ..., login_url: Optional[str] = ...) -> Callable[[_VIEW], _VIEW]: ...
|
||||||
|
@overload
|
||||||
|
def login_required(function: _VIEW, redirect_field_name: str = ..., login_url: Optional[str] = ...) -> _VIEW: ...
|
||||||
def permission_required(
|
def permission_required(
|
||||||
perm: Union[List[str], Set[str], str], login_url: None = ..., raise_exception: bool = ...
|
perm: Union[List[str], Set[str], str], login_url: None = ..., raise_exception: bool = ...
|
||||||
) -> Callable: ...
|
) -> Callable[[_VIEW], _VIEW]: ...
|
||||||
|
|||||||
@@ -1,84 +1,36 @@
|
|||||||
import collections
|
from typing import Any, Dict, Iterator, Optional
|
||||||
import datetime
|
|
||||||
from typing import Any, Dict, Iterator, List, Optional, Union, Type
|
|
||||||
|
|
||||||
from django.contrib.auth.base_user import AbstractBaseUser
|
from django.contrib.auth.base_user import AbstractBaseUser
|
||||||
from django.contrib.auth.models import AbstractUser, User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.forms.utils import ErrorList
|
|
||||||
from django.http.request import QueryDict
|
|
||||||
from django.utils.datastructures import MultiValueDict
|
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
UserModel: Any
|
UserModel: Any
|
||||||
|
|
||||||
class ReadOnlyPasswordHashWidget(forms.Widget):
|
class ReadOnlyPasswordHashWidget(forms.Widget):
|
||||||
attrs: Dict[Any, Any]
|
|
||||||
template_name: str = ...
|
template_name: str = ...
|
||||||
|
|
||||||
class ReadOnlyPasswordHashField(forms.Field):
|
class ReadOnlyPasswordHashField(forms.Field):
|
||||||
widget: Any = ...
|
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def bound_data(self, data: None, initial: str) -> str: ...
|
|
||||||
def has_changed(self, initial: str, data: Optional[str]) -> bool: ...
|
|
||||||
|
|
||||||
class UsernameField(forms.CharField):
|
class UsernameField(forms.CharField): ...
|
||||||
def to_python(self, value: Optional[str]) -> str: ...
|
|
||||||
|
|
||||||
class UserCreationForm(forms.ModelForm):
|
class UserCreationForm(forms.ModelForm):
|
||||||
auto_id: str
|
|
||||||
data: Dict[str, str]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: Type[ErrorList]
|
|
||||||
fields: collections.OrderedDict
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[Any, Any]
|
|
||||||
instance: User
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
error_messages: Any = ...
|
error_messages: Any = ...
|
||||||
password1: Any = ...
|
password1: Any = ...
|
||||||
password2: Any = ...
|
password2: Any = ...
|
||||||
class Meta:
|
|
||||||
model: Any = ...
|
|
||||||
fields: Any = ...
|
|
||||||
field_classes: Any = ...
|
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def clean_password2(self) -> str: ...
|
def clean_password2(self) -> str: ...
|
||||||
def save(self, commit: bool = ...) -> User: ...
|
|
||||||
|
|
||||||
class UserChangeForm(forms.ModelForm):
|
class UserChangeForm(forms.ModelForm):
|
||||||
auto_id: str
|
|
||||||
data: Dict[Any, Any]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: Type[ErrorList]
|
|
||||||
fields: collections.OrderedDict
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[str, Optional[Union[List[Any], datetime.datetime, int, str]]]
|
|
||||||
instance: User
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
password: Any = ...
|
password: Any = ...
|
||||||
class Meta:
|
|
||||||
model: Any = ...
|
|
||||||
fields: str = ...
|
|
||||||
field_classes: Any = ...
|
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def clean_password(self) -> str: ...
|
def clean_password(self) -> str: ...
|
||||||
|
|
||||||
class AuthenticationForm(forms.Form):
|
class AuthenticationForm(forms.Form):
|
||||||
auto_id: str
|
|
||||||
data: QueryDict
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: Type[ErrorList]
|
|
||||||
fields: collections.OrderedDict
|
|
||||||
files: MultiValueDict
|
|
||||||
initial: Dict[Any, Any]
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
username: Any = ...
|
username: Any = ...
|
||||||
password: Any = ...
|
password: Any = ...
|
||||||
error_messages: Any = ...
|
error_messages: Any = ...
|
||||||
@@ -91,21 +43,12 @@ class AuthenticationForm(forms.Form):
|
|||||||
def get_invalid_login_error(self) -> ValidationError: ...
|
def get_invalid_login_error(self) -> ValidationError: ...
|
||||||
|
|
||||||
class PasswordResetForm(forms.Form):
|
class PasswordResetForm(forms.Form):
|
||||||
auto_id: str
|
|
||||||
data: Dict[Any, Any]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: Type[ErrorList]
|
|
||||||
fields: collections.OrderedDict
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[Any, Any]
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
email: Any = ...
|
email: Any = ...
|
||||||
def send_mail(
|
def send_mail(
|
||||||
self,
|
self,
|
||||||
subject_template_name: str,
|
subject_template_name: str,
|
||||||
email_template_name: str,
|
email_template_name: str,
|
||||||
context: Dict[str, Union[AbstractBaseUser, str]],
|
context: Dict[str, Any],
|
||||||
from_email: Optional[str],
|
from_email: Optional[str],
|
||||||
to_email: str,
|
to_email: str,
|
||||||
html_email_template_name: Optional[str] = ...,
|
html_email_template_name: Optional[str] = ...,
|
||||||
@@ -125,15 +68,6 @@ class PasswordResetForm(forms.Form):
|
|||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
class SetPasswordForm(forms.Form):
|
class SetPasswordForm(forms.Form):
|
||||||
auto_id: str
|
|
||||||
data: Dict[Any, Any]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: Type[ErrorList]
|
|
||||||
fields: collections.OrderedDict
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[Any, Any]
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
error_messages: Any = ...
|
error_messages: Any = ...
|
||||||
new_password1: Any = ...
|
new_password1: Any = ...
|
||||||
new_password2: Any = ...
|
new_password2: Any = ...
|
||||||
@@ -143,38 +77,15 @@ class SetPasswordForm(forms.Form):
|
|||||||
def save(self, commit: bool = ...) -> AbstractBaseUser: ...
|
def save(self, commit: bool = ...) -> AbstractBaseUser: ...
|
||||||
|
|
||||||
class PasswordChangeForm(SetPasswordForm):
|
class PasswordChangeForm(SetPasswordForm):
|
||||||
auto_id: str
|
|
||||||
data: Dict[Any, Any]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: Type[ErrorList]
|
|
||||||
fields: collections.OrderedDict
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[Any, Any]
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
user: User
|
|
||||||
error_messages: Any = ...
|
|
||||||
old_password: Any = ...
|
old_password: Any = ...
|
||||||
field_order: Any = ...
|
|
||||||
def clean_old_password(self) -> str: ...
|
def clean_old_password(self) -> str: ...
|
||||||
|
|
||||||
class AdminPasswordChangeForm(forms.Form):
|
class AdminPasswordChangeForm(forms.Form):
|
||||||
auto_id: str
|
|
||||||
data: Dict[Any, Any]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: Type[ErrorList]
|
|
||||||
fields: collections.OrderedDict
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[Any, Any]
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
error_messages: Any = ...
|
error_messages: Any = ...
|
||||||
required_css_class: str = ...
|
required_css_class: str = ...
|
||||||
password1: Any = ...
|
password1: Any = ...
|
||||||
password2: Any = ...
|
password2: Any = ...
|
||||||
user: User = ...
|
user: User = ...
|
||||||
def __init__(self, user: AbstractUser, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, user: AbstractBaseUser, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def clean_password2(self) -> str: ...
|
def clean_password2(self) -> str: ...
|
||||||
def save(self, commit: bool = ...) -> AbstractUser: ...
|
def save(self, commit: bool = ...) -> AbstractBaseUser: ...
|
||||||
@property
|
|
||||||
def changed_data(self) -> List[str]: ...
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict
|
||||||
|
|
||||||
UserModel: Any
|
UserModel: Any
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
from collections import OrderedDict
|
|
||||||
from typing import Any, Callable, Dict, List, Optional
|
from typing import Any, Callable, Dict, List, Optional
|
||||||
|
|
||||||
UNUSABLE_PASSWORD_PREFIX: str
|
UNUSABLE_PASSWORD_PREFIX: str
|
||||||
@@ -17,92 +16,30 @@ def identify_hasher(encoded: str) -> BasePasswordHasher: ...
|
|||||||
def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ...
|
def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ...
|
||||||
|
|
||||||
class BasePasswordHasher:
|
class BasePasswordHasher:
|
||||||
algorithm: Any = ...
|
algorithm: str = ...
|
||||||
library: Any = ...
|
library: str = ...
|
||||||
|
rounds: int = ...
|
||||||
|
time_cost: int = ...
|
||||||
|
memory_cost: int = ...
|
||||||
|
parallelism: int = ...
|
||||||
|
digest: Any = ...
|
||||||
|
iterations: int = ...
|
||||||
def salt(self) -> str: ...
|
def salt(self) -> str: ...
|
||||||
def verify(self, password: str, encoded: str) -> Any: ...
|
def verify(self, password: str, encoded: str) -> bool: ...
|
||||||
def encode(self, password: str, salt: str) -> Any: ...
|
def encode(self, password: str, salt: str) -> Any: ...
|
||||||
def safe_summary(self, encoded: str) -> Any: ...
|
def safe_summary(self, encoded: str) -> Any: ...
|
||||||
def must_update(self, encoded: str) -> bool: ...
|
def must_update(self, encoded: str) -> bool: ...
|
||||||
def harden_runtime(self, password: str, encoded: str) -> None: ...
|
def harden_runtime(self, password: str, encoded: str) -> None: ...
|
||||||
|
|
||||||
class PBKDF2PasswordHasher(BasePasswordHasher):
|
class PBKDF2PasswordHasher(BasePasswordHasher):
|
||||||
algorithm: str = ...
|
|
||||||
iterations: int = ...
|
|
||||||
digest: Any = ...
|
|
||||||
def encode(self, password: str, salt: str, iterations: Optional[int] = ...) -> str: ...
|
def encode(self, password: str, salt: str, iterations: Optional[int] = ...) -> str: ...
|
||||||
def verify(self, password: str, encoded: str) -> bool: ...
|
|
||||||
def safe_summary(self, encoded: str) -> OrderedDict: ...
|
|
||||||
def must_update(self, encoded: str) -> bool: ...
|
|
||||||
def harden_runtime(self, password: str, encoded: str) -> None: ...
|
|
||||||
|
|
||||||
class PBKDF2SHA1PasswordHasher(PBKDF2PasswordHasher):
|
class PBKDF2SHA1PasswordHasher(PBKDF2PasswordHasher): ...
|
||||||
algorithm: str = ...
|
class Argon2PasswordHasher(BasePasswordHasher): ...
|
||||||
digest: Any = ...
|
class BCryptSHA256PasswordHasher(BasePasswordHasher): ...
|
||||||
|
class BCryptPasswordHasher(BCryptSHA256PasswordHasher): ...
|
||||||
class Argon2PasswordHasher(BasePasswordHasher):
|
class SHA1PasswordHasher(BasePasswordHasher): ...
|
||||||
algorithm: str = ...
|
class MD5PasswordHasher(BasePasswordHasher): ...
|
||||||
library: str = ...
|
class UnsaltedSHA1PasswordHasher(BasePasswordHasher): ...
|
||||||
time_cost: int = ...
|
class UnsaltedMD5PasswordHasher(BasePasswordHasher): ...
|
||||||
memory_cost: int = ...
|
class CryptPasswordHasher(BasePasswordHasher): ...
|
||||||
parallelism: int = ...
|
|
||||||
def encode(self, password: Any, salt: Any): ...
|
|
||||||
def verify(self, password: Any, encoded: Any): ...
|
|
||||||
def safe_summary(self, encoded: Any): ...
|
|
||||||
def must_update(self, encoded: Any): ...
|
|
||||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
|
||||||
|
|
||||||
class BCryptSHA256PasswordHasher(BasePasswordHasher):
|
|
||||||
algorithm: str = ...
|
|
||||||
digest: Any = ...
|
|
||||||
library: Any = ...
|
|
||||||
rounds: int = ...
|
|
||||||
def salt(self): ...
|
|
||||||
def encode(self, password: Any, salt: Any): ...
|
|
||||||
def verify(self, password: Any, encoded: Any): ...
|
|
||||||
def safe_summary(self, encoded: Any): ...
|
|
||||||
def must_update(self, encoded: Any): ...
|
|
||||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
|
||||||
|
|
||||||
class BCryptPasswordHasher(BCryptSHA256PasswordHasher):
|
|
||||||
algorithm: str = ...
|
|
||||||
digest: Any = ...
|
|
||||||
|
|
||||||
class SHA1PasswordHasher(BasePasswordHasher):
|
|
||||||
algorithm: str = ...
|
|
||||||
def encode(self, password: str, salt: str) -> str: ...
|
|
||||||
def verify(self, password: str, encoded: str) -> bool: ...
|
|
||||||
def safe_summary(self, encoded: Any): ...
|
|
||||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
|
||||||
|
|
||||||
class MD5PasswordHasher(BasePasswordHasher):
|
|
||||||
algorithm: str = ...
|
|
||||||
def encode(self, password: str, salt: str) -> str: ...
|
|
||||||
def verify(self, password: str, encoded: str) -> bool: ...
|
|
||||||
def safe_summary(self, encoded: str) -> OrderedDict: ...
|
|
||||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
|
||||||
|
|
||||||
class UnsaltedSHA1PasswordHasher(BasePasswordHasher):
|
|
||||||
algorithm: str = ...
|
|
||||||
def salt(self) -> str: ...
|
|
||||||
def encode(self, password: str, salt: str) -> str: ...
|
|
||||||
def verify(self, password: str, encoded: str) -> bool: ...
|
|
||||||
def safe_summary(self, encoded: Any): ...
|
|
||||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
|
||||||
|
|
||||||
class UnsaltedMD5PasswordHasher(BasePasswordHasher):
|
|
||||||
algorithm: str = ...
|
|
||||||
def salt(self) -> str: ...
|
|
||||||
def encode(self, password: str, salt: str) -> str: ...
|
|
||||||
def verify(self, password: str, encoded: str) -> bool: ...
|
|
||||||
def safe_summary(self, encoded: Any): ...
|
|
||||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
|
||||||
|
|
||||||
class CryptPasswordHasher(BasePasswordHasher):
|
|
||||||
algorithm: str = ...
|
|
||||||
library: str = ...
|
|
||||||
def salt(self): ...
|
|
||||||
def encode(self, password: Any, salt: Any): ...
|
|
||||||
def verify(self, password: Any, encoded: Any): ...
|
|
||||||
def safe_summary(self, encoded: Any): ...
|
|
||||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
|
import getpass as getpass # noqa: F401
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
class NotRunningInTTYException(Exception): ...
|
class NotRunningInTTYException(Exception): ...
|
||||||
class Command(BaseCommand): ...
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
stdin: Any
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ class AuthenticationMiddleware(MiddlewareMixin):
|
|||||||
class RemoteUserMiddleware(MiddlewareMixin):
|
class RemoteUserMiddleware(MiddlewareMixin):
|
||||||
header: str = ...
|
header: str = ...
|
||||||
force_logout_if_no_header: bool = ...
|
force_logout_if_no_header: bool = ...
|
||||||
def process_request(self, request: WSGIRequest) -> None: ...
|
def process_request(self, request: HttpRequest) -> None: ...
|
||||||
def clean_username(self, username: str, request: WSGIRequest) -> str: ...
|
def clean_username(self, username: str, request: HttpRequest) -> str: ...
|
||||||
|
|
||||||
class PersistentRemoteUserMiddleware(RemoteUserMiddleware):
|
class PersistentRemoteUserMiddleware(RemoteUserMiddleware):
|
||||||
force_logout_if_no_header: bool = ...
|
force_logout_if_no_header: bool = ...
|
||||||
|
|||||||
0
django-stubs/contrib/auth/migrations/__init__.pyi
Normal file
0
django-stubs/contrib/auth/migrations/__init__.pyi
Normal file
@@ -1,6 +1,6 @@
|
|||||||
from typing import Any, Callable, List, Optional
|
from typing import Any, Callable, List, Optional
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django import http
|
||||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||||
|
|
||||||
class AccessMixin:
|
class AccessMixin:
|
||||||
@@ -14,15 +14,15 @@ class AccessMixin:
|
|||||||
def handle_no_permission(self) -> HttpResponseRedirect: ...
|
def handle_no_permission(self) -> HttpResponseRedirect: ...
|
||||||
|
|
||||||
class LoginRequiredMixin(AccessMixin):
|
class LoginRequiredMixin(AccessMixin):
|
||||||
def dispatch(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
|
|
||||||
class PermissionRequiredMixin(AccessMixin):
|
class PermissionRequiredMixin(AccessMixin):
|
||||||
permission_required: Any = ...
|
permission_required: Any = ...
|
||||||
def get_permission_required(self) -> List[str]: ...
|
def get_permission_required(self) -> List[str]: ...
|
||||||
def has_permission(self) -> bool: ...
|
def has_permission(self) -> bool: ...
|
||||||
def dispatch(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
|
|
||||||
class UserPassesTestMixin(AccessMixin):
|
class UserPassesTestMixin(AccessMixin):
|
||||||
def test_func(self) -> None: ...
|
def test_func(self) -> Optional[bool]: ...
|
||||||
def get_test_func(self) -> Callable: ...
|
def get_test_func(self) -> Callable: ...
|
||||||
def dispatch(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -1,75 +1,88 @@
|
|||||||
import datetime
|
import sys
|
||||||
from typing import Any, List, Optional, Set, Tuple, Type, Union
|
from typing import Any, Collection, Optional, Set, Tuple, Type, TypeVar, Union
|
||||||
|
|
||||||
|
from django.contrib.auth.backends import ModelBackend
|
||||||
from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser, BaseUserManager as BaseUserManager
|
from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser, BaseUserManager as BaseUserManager
|
||||||
|
from django.contrib.auth.validators import UnicodeUsernameValidator
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
from django.db.models.base import Model
|
||||||
from django.db.models.manager import EmptyManager
|
from django.db.models.manager import EmptyManager
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
if sys.version_info < (3, 8):
|
||||||
|
from typing_extensions import Literal
|
||||||
|
else:
|
||||||
|
from typing import Literal
|
||||||
|
|
||||||
|
_AnyUser = Union[Model, "AnonymousUser"]
|
||||||
|
|
||||||
def update_last_login(sender: Type[AbstractBaseUser], user: AbstractBaseUser, **kwargs: Any) -> None: ...
|
def update_last_login(sender: Type[AbstractBaseUser], user: AbstractBaseUser, **kwargs: Any) -> None: ...
|
||||||
|
|
||||||
class PermissionManager(models.Manager):
|
class PermissionManager(models.Manager["Permission"]):
|
||||||
creation_counter: int
|
|
||||||
model: None
|
|
||||||
name: None
|
|
||||||
use_in_migrations: bool = ...
|
|
||||||
def get_by_natural_key(self, codename: str, app_label: str, model: str) -> Permission: ...
|
def get_by_natural_key(self, codename: str, app_label: str, model: str) -> Permission: ...
|
||||||
|
|
||||||
class Permission(models.Model):
|
class Permission(models.Model):
|
||||||
content_type_id: int
|
content_type_id: int
|
||||||
id: int
|
objects: PermissionManager
|
||||||
name: str = ...
|
|
||||||
content_type: Any = ...
|
name = models.CharField(max_length=255)
|
||||||
codename: str = ...
|
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
||||||
|
codename = models.CharField(max_length=100)
|
||||||
def natural_key(self) -> Tuple[str, str, str]: ...
|
def natural_key(self) -> Tuple[str, str, str]: ...
|
||||||
|
|
||||||
class GroupManager(models.Manager):
|
class GroupManager(models.Manager["Group"]):
|
||||||
creation_counter: int
|
|
||||||
model: None
|
|
||||||
name: None
|
|
||||||
use_in_migrations: bool = ...
|
|
||||||
def get_by_natural_key(self, name: str) -> Group: ...
|
def get_by_natural_key(self, name: str) -> Group: ...
|
||||||
|
|
||||||
class Group(models.Model):
|
class Group(models.Model):
|
||||||
id: None
|
objects: GroupManager
|
||||||
name: str = ...
|
|
||||||
permissions: Any = ...
|
name = models.CharField(max_length=150)
|
||||||
|
permissions = models.ManyToManyField(Permission)
|
||||||
def natural_key(self): ...
|
def natural_key(self): ...
|
||||||
|
|
||||||
class UserManager(BaseUserManager):
|
_T = TypeVar("_T", bound=Model)
|
||||||
creation_counter: int
|
|
||||||
model: None
|
class UserManager(BaseUserManager[_T]):
|
||||||
name: None
|
|
||||||
use_in_migrations: bool = ...
|
|
||||||
def create_user(
|
def create_user(
|
||||||
self, username: str, email: Optional[str] = ..., password: Optional[str] = ..., **extra_fields: Any
|
self, username: str, email: Optional[str] = ..., password: Optional[str] = ..., **extra_fields: Any
|
||||||
) -> AbstractUser: ...
|
) -> _T: ...
|
||||||
def create_superuser(
|
def create_superuser(
|
||||||
self, username: str, email: Optional[str], password: Optional[str], **extra_fields: Any
|
self, username: str, email: Optional[str], password: Optional[str], **extra_fields: Any
|
||||||
) -> AbstractBaseUser: ...
|
) -> _T: ...
|
||||||
|
def with_perm(
|
||||||
|
self,
|
||||||
|
perm: Union[str, Permission],
|
||||||
|
is_active: bool = ...,
|
||||||
|
include_superusers: bool = ...,
|
||||||
|
backend: Optional[Union[Type[ModelBackend], str]] = ...,
|
||||||
|
obj: Optional[Model] = ...,
|
||||||
|
): ...
|
||||||
|
|
||||||
class PermissionsMixin(models.Model):
|
class PermissionsMixin(models.Model):
|
||||||
is_superuser: Any = ...
|
is_superuser = models.BooleanField()
|
||||||
groups: Any = ...
|
groups = models.ManyToManyField(Group)
|
||||||
user_permissions: Any = ...
|
user_permissions = models.ManyToManyField(Permission)
|
||||||
def get_group_permissions(self, obj: None = ...) -> Set[str]: ...
|
def get_user_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ...
|
||||||
def get_all_permissions(self, obj: Optional[str] = ...) -> Set[str]: ...
|
def get_group_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ...
|
||||||
def has_perm(self, perm: Union[Tuple[str, Any], str], obj: Optional[str] = ...) -> bool: ...
|
def get_all_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ...
|
||||||
def has_perms(self, perm_list: Union[List[str], Set[str], Tuple[str]], obj: None = ...) -> bool: ...
|
def has_perm(self, perm: str, obj: Optional[_AnyUser] = ...) -> bool: ...
|
||||||
|
def has_perms(self, perm_list: Collection[str], obj: Optional[_AnyUser] = ...) -> bool: ...
|
||||||
def has_module_perms(self, app_label: str) -> bool: ...
|
def has_module_perms(self, app_label: str) -> bool: ...
|
||||||
|
|
||||||
class AbstractUser(AbstractBaseUser, PermissionsMixin):
|
class AbstractUser(AbstractBaseUser, PermissionsMixin): # type: ignore
|
||||||
is_superuser: bool
|
username_validator: UnicodeUsernameValidator = ...
|
||||||
username_validator: Any = ...
|
|
||||||
username: str = ...
|
username = models.CharField(max_length=150)
|
||||||
first_name: str = ...
|
first_name = models.CharField(max_length=30, blank=True)
|
||||||
last_name: str = ...
|
last_name = models.CharField(max_length=150, blank=True)
|
||||||
email: str = ...
|
email = models.EmailField(blank=True)
|
||||||
is_staff: bool = ...
|
is_staff = models.BooleanField()
|
||||||
date_joined: datetime.datetime = ...
|
is_active = models.BooleanField()
|
||||||
|
date_joined = models.DateTimeField()
|
||||||
|
|
||||||
EMAIL_FIELD: str = ...
|
EMAIL_FIELD: str = ...
|
||||||
USERNAME_FIELD: str = ...
|
USERNAME_FIELD: str = ...
|
||||||
def clean(self) -> None: ...
|
|
||||||
def get_full_name(self) -> str: ...
|
def get_full_name(self) -> str: ...
|
||||||
def get_short_name(self) -> str: ...
|
def get_short_name(self) -> str: ...
|
||||||
def email_user(self, subject: str, message: str, from_email: str = ..., **kwargs: Any) -> None: ...
|
def email_user(self, subject: str, message: str, from_email: str = ..., **kwargs: Any) -> None: ...
|
||||||
@@ -91,13 +104,14 @@ class AnonymousUser:
|
|||||||
def groups(self) -> EmptyManager: ...
|
def groups(self) -> EmptyManager: ...
|
||||||
@property
|
@property
|
||||||
def user_permissions(self) -> EmptyManager: ...
|
def user_permissions(self) -> EmptyManager: ...
|
||||||
def get_group_permissions(self, obj: None = ...) -> Set[Any]: ...
|
def get_user_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ...
|
||||||
def get_all_permissions(self, obj: Any = ...) -> Set[str]: ...
|
def get_group_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[Any]: ...
|
||||||
def has_perm(self, perm: str, obj: None = ...) -> bool: ...
|
def get_all_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ...
|
||||||
def has_perms(self, perm_list: Union[List[str], Tuple[str]], obj: None = ...) -> bool: ...
|
def has_perm(self, perm: str, obj: Optional[_AnyUser] = ...) -> bool: ...
|
||||||
|
def has_perms(self, perm_list: Collection[str], obj: Optional[_AnyUser] = ...) -> bool: ...
|
||||||
def has_module_perms(self, module: str) -> bool: ...
|
def has_module_perms(self, module: str) -> bool: ...
|
||||||
@property
|
@property
|
||||||
def is_anonymous(self) -> bool: ...
|
def is_anonymous(self) -> Literal[True]: ...
|
||||||
@property
|
@property
|
||||||
def is_authenticated(self) -> bool: ...
|
def is_authenticated(self) -> Literal[False]: ...
|
||||||
def get_username(self) -> str: ...
|
def get_username(self) -> str: ...
|
||||||
|
|||||||
@@ -1,48 +1,46 @@
|
|||||||
from pathlib import PosixPath
|
from pathlib import Path, PosixPath
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Any, List, Mapping, Optional, Protocol, Sequence, Set, Union
|
||||||
|
|
||||||
from django.contrib.auth.base_user import AbstractBaseUser
|
from django.db.models.base import Model
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
|
||||||
def get_default_password_validators() -> Union[
|
_UserModel = Model
|
||||||
List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]
|
|
||||||
]: ...
|
class PasswordValidator(Protocol):
|
||||||
def get_password_validators(
|
def password_changed(self, password: str, user: Optional[_UserModel] = ...): ...
|
||||||
validator_config: List[Dict[str, Union[Dict[str, int], str]]]
|
|
||||||
) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
def get_default_password_validators() -> List[PasswordValidator]: ...
|
||||||
|
def get_password_validators(validator_config: Sequence[Mapping[str, Any]]) -> List[PasswordValidator]: ...
|
||||||
def validate_password(
|
def validate_password(
|
||||||
password: str, user: Optional[AbstractBaseUser] = ..., password_validators: Optional[List[Any]] = ...
|
password: str, user: Optional[_UserModel] = ..., password_validators: Optional[Sequence[PasswordValidator]] = ...
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def password_changed(
|
def password_changed(
|
||||||
password: str, user: Optional[AbstractBaseUser] = ..., password_validators: None = ...
|
password: str, user: Optional[_UserModel] = ..., password_validators: Optional[Sequence[PasswordValidator]] = ...
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def password_validators_help_texts(password_validators: Optional[List[Any]] = ...) -> List[str]: ...
|
def password_validators_help_texts(password_validators: Optional[Sequence[PasswordValidator]] = ...) -> List[str]: ...
|
||||||
|
|
||||||
password_validators_help_text_html: Any
|
password_validators_help_text_html: Any
|
||||||
|
|
||||||
class MinimumLengthValidator:
|
class MinimumLengthValidator:
|
||||||
min_length: int = ...
|
min_length: int = ...
|
||||||
def __init__(self, min_length: int = ...) -> None: ...
|
def __init__(self, min_length: int = ...) -> None: ...
|
||||||
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
|
def validate(self, password: str, user: Optional[_UserModel] = ...) -> None: ...
|
||||||
def get_help_text(self) -> str: ...
|
def get_help_text(self) -> str: ...
|
||||||
|
|
||||||
class UserAttributeSimilarityValidator:
|
class UserAttributeSimilarityValidator:
|
||||||
DEFAULT_USER_ATTRIBUTES: Any = ...
|
DEFAULT_USER_ATTRIBUTES: Sequence[str] = ...
|
||||||
user_attributes: Tuple[str, str, str, str] = ...
|
user_attributes: Sequence[str] = ...
|
||||||
max_similarity: float = ...
|
max_similarity: float = ...
|
||||||
def __init__(
|
def __init__(self, user_attributes: Sequence[str] = ..., max_similarity: float = ...) -> None: ...
|
||||||
self, user_attributes: Union[List[str], Tuple[str, str, str, str]] = ..., max_similarity: float = ...
|
def validate(self, password: str, user: Optional[_UserModel] = ...) -> None: ...
|
||||||
) -> None: ...
|
|
||||||
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
|
|
||||||
def get_help_text(self) -> str: ...
|
def get_help_text(self) -> str: ...
|
||||||
|
|
||||||
class CommonPasswordValidator:
|
class CommonPasswordValidator:
|
||||||
DEFAULT_PASSWORD_LIST_PATH: Any = ...
|
DEFAULT_PASSWORD_LIST_PATH: Path = ...
|
||||||
passwords: Set[str] = ...
|
passwords: Set[str] = ...
|
||||||
def __init__(self, password_list_path: Union[PosixPath, str] = ...) -> None: ...
|
def __init__(self, password_list_path: Union[PosixPath, str] = ...) -> None: ...
|
||||||
def validate(self, password: str, user: None = ...) -> None: ...
|
def validate(self, password: str, user: Optional[_UserModel] = ...) -> None: ...
|
||||||
def get_help_text(self) -> str: ...
|
def get_help_text(self) -> str: ...
|
||||||
|
|
||||||
class NumericPasswordValidator:
|
class NumericPasswordValidator:
|
||||||
def validate(self, password: str, user: Optional[AbstractBaseUser] = ...) -> None: ...
|
def validate(self, password: str, user: Optional[_UserModel] = ...) -> None: ...
|
||||||
def get_help_text(self) -> str: ...
|
def get_help_text(self) -> str: ...
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
from datetime import date
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from django.contrib.auth.base_user import AbstractBaseUser
|
from django.contrib.auth.base_user import AbstractBaseUser
|
||||||
@@ -5,7 +6,12 @@ from django.contrib.auth.base_user import AbstractBaseUser
|
|||||||
class PasswordResetTokenGenerator:
|
class PasswordResetTokenGenerator:
|
||||||
key_salt: str = ...
|
key_salt: str = ...
|
||||||
secret: Any = ...
|
secret: Any = ...
|
||||||
|
algorithm: str = ...
|
||||||
def make_token(self, user: AbstractBaseUser) -> str: ...
|
def make_token(self, user: AbstractBaseUser) -> str: ...
|
||||||
def check_token(self, user: Optional[AbstractBaseUser], token: Optional[str]) -> bool: ...
|
def check_token(self, user: Optional[AbstractBaseUser], token: Optional[str]) -> bool: ...
|
||||||
|
def _make_token_with_timestamp(self, user: AbstractBaseUser, timestamp: int) -> str: ...
|
||||||
|
def _make_hash_value(self, user: AbstractBaseUser, timestamp: int) -> str: ...
|
||||||
|
def _num_days(self, dt: date) -> float: ...
|
||||||
|
def _today(self) -> date: ...
|
||||||
|
|
||||||
default_token_generator: Any
|
default_token_generator: Any
|
||||||
|
|||||||
3
django-stubs/contrib/auth/urls.pyi
Normal file
3
django-stubs/contrib/auth/urls.pyi
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from typing import Any, List
|
||||||
|
|
||||||
|
urlpatterns: List[Any] = ...
|
||||||
4
django-stubs/contrib/auth/validators.pyi
Normal file
4
django-stubs/contrib/auth/validators.pyi
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
from django.core import validators
|
||||||
|
|
||||||
|
class ASCIIUsernameValidator(validators.RegexValidator): ...
|
||||||
|
class UnicodeUsernameValidator(validators.RegexValidator): ...
|
||||||
@@ -1,15 +1,11 @@
|
|||||||
from typing import Any, Dict, Optional, Set, Type, Union
|
from typing import Any, Optional, Set
|
||||||
|
|
||||||
from django.contrib.auth.base_user import AbstractBaseUser
|
from django.contrib.auth.base_user import AbstractBaseUser
|
||||||
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm, PasswordResetForm, SetPasswordForm
|
from django.contrib.auth.forms import AuthenticationForm
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from django.contrib.sites.models import Site
|
|
||||||
from django.contrib.sites.requests import RequestSite
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
from django.http.response import HttpResponseRedirect
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.utils.datastructures import MultiValueDict
|
|
||||||
from django.views.generic.base import TemplateView
|
from django.views.generic.base import TemplateView
|
||||||
from django.views.generic.edit import FormView
|
from django.views.generic.edit import FormView
|
||||||
|
|
||||||
@@ -19,32 +15,19 @@ class SuccessURLAllowedHostsMixin:
|
|||||||
success_url_allowed_hosts: Any = ...
|
success_url_allowed_hosts: Any = ...
|
||||||
def get_success_url_allowed_hosts(self) -> Set[str]: ...
|
def get_success_url_allowed_hosts(self) -> Set[str]: ...
|
||||||
|
|
||||||
class LoginView(SuccessURLAllowedHostsMixin, FormView):
|
class LoginView(SuccessURLAllowedHostsMixin, FormView[AuthenticationForm]):
|
||||||
form_class: Any = ...
|
|
||||||
authentication_form: Any = ...
|
authentication_form: Any = ...
|
||||||
redirect_field_name: Any = ...
|
redirect_field_name: Any = ...
|
||||||
template_name: str = ...
|
|
||||||
redirect_authenticated_user: bool = ...
|
redirect_authenticated_user: bool = ...
|
||||||
extra_context: Any = ...
|
extra_context: Any = ...
|
||||||
def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
|
||||||
def get_success_url(self) -> str: ...
|
|
||||||
def get_redirect_url(self) -> str: ...
|
def get_redirect_url(self) -> str: ...
|
||||||
def get_form_class(self) -> Type[AuthenticationForm]: ...
|
|
||||||
def get_form_kwargs(self) -> Dict[str, Optional[Union[Dict[str, str], HttpRequest, MultiValueDict]]]: ...
|
|
||||||
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
|
|
||||||
def get_context_data(
|
|
||||||
self, **kwargs: Any
|
|
||||||
) -> Dict[str, Union[AuthenticationForm, LoginView, Site, RequestSite, str]]: ...
|
|
||||||
|
|
||||||
class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
|
class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
|
||||||
next_page: Any = ...
|
next_page: Any = ...
|
||||||
redirect_field_name: Any = ...
|
redirect_field_name: Any = ...
|
||||||
template_name: str = ...
|
|
||||||
extra_context: Any = ...
|
extra_context: Any = ...
|
||||||
def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
|
||||||
def post(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> TemplateResponse: ...
|
def post(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> TemplateResponse: ...
|
||||||
def get_next_page(self) -> Optional[str]: ...
|
def get_next_page(self) -> Optional[str]: ...
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
|
||||||
|
|
||||||
def logout_then_login(request: HttpRequest, login_url: Optional[str] = ...) -> HttpResponseRedirect: ...
|
def logout_then_login(request: HttpRequest, login_url: Optional[str] = ...) -> HttpResponseRedirect: ...
|
||||||
def redirect_to_login(
|
def redirect_to_login(
|
||||||
@@ -58,55 +41,33 @@ class PasswordContextMixin:
|
|||||||
class PasswordResetView(PasswordContextMixin, FormView):
|
class PasswordResetView(PasswordContextMixin, FormView):
|
||||||
email_template_name: str = ...
|
email_template_name: str = ...
|
||||||
extra_email_context: Any = ...
|
extra_email_context: Any = ...
|
||||||
form_class: Any = ...
|
|
||||||
from_email: Any = ...
|
from_email: Any = ...
|
||||||
html_email_template_name: Any = ...
|
html_email_template_name: Any = ...
|
||||||
subject_template_name: str = ...
|
subject_template_name: str = ...
|
||||||
success_url: Any = ...
|
|
||||||
template_name: str = ...
|
|
||||||
title: Any = ...
|
title: Any = ...
|
||||||
token_generator: Any = ...
|
token_generator: Any = ...
|
||||||
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
|
||||||
def form_valid(self, form: PasswordResetForm) -> HttpResponseRedirect: ...
|
|
||||||
|
|
||||||
INTERNAL_RESET_URL_TOKEN: str
|
INTERNAL_RESET_URL_TOKEN: str
|
||||||
INTERNAL_RESET_SESSION_TOKEN: str
|
INTERNAL_RESET_SESSION_TOKEN: str
|
||||||
|
|
||||||
class PasswordResetDoneView(PasswordContextMixin, TemplateView):
|
class PasswordResetDoneView(PasswordContextMixin, TemplateView):
|
||||||
template_name: str = ...
|
|
||||||
title: Any = ...
|
title: Any = ...
|
||||||
|
|
||||||
class PasswordResetConfirmView(PasswordContextMixin, FormView):
|
class PasswordResetConfirmView(PasswordContextMixin, FormView):
|
||||||
form_class: Any = ...
|
|
||||||
post_reset_login: bool = ...
|
post_reset_login: bool = ...
|
||||||
post_reset_login_backend: Any = ...
|
post_reset_login_backend: Any = ...
|
||||||
success_url: Any = ...
|
reset_url_token: str = ...
|
||||||
template_name: str = ...
|
|
||||||
title: Any = ...
|
title: Any = ...
|
||||||
token_generator: Any = ...
|
token_generator: Any = ...
|
||||||
validlink: bool = ...
|
validlink: bool = ...
|
||||||
user: Any = ...
|
user: Any = ...
|
||||||
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
|
||||||
def get_user(self, uidb64: str) -> Optional[AbstractBaseUser]: ...
|
def get_user(self, uidb64: str) -> Optional[AbstractBaseUser]: ...
|
||||||
def get_form_kwargs(self) -> Dict[str, Optional[Union[Dict[Any, Any], AbstractBaseUser, MultiValueDict]]]: ...
|
|
||||||
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
|
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
|
||||||
|
|
||||||
class PasswordResetCompleteView(PasswordContextMixin, TemplateView):
|
class PasswordResetCompleteView(PasswordContextMixin, TemplateView):
|
||||||
template_name: str = ...
|
|
||||||
title: Any = ...
|
title: Any = ...
|
||||||
def get_context_data(self, **kwargs: Any): ...
|
|
||||||
|
|
||||||
class PasswordChangeView(PasswordContextMixin, FormView):
|
class PasswordChangeView(PasswordContextMixin, FormView):
|
||||||
form_class: Any = ...
|
|
||||||
success_url: Any = ...
|
|
||||||
template_name: str = ...
|
|
||||||
title: Any = ...
|
title: Any = ...
|
||||||
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
|
||||||
def get_form_kwargs(self) -> Dict[str, Optional[Union[Dict[Any, Any], User, MultiValueDict]]]: ...
|
|
||||||
def form_valid(self, form: PasswordChangeForm) -> HttpResponseRedirect: ...
|
|
||||||
|
|
||||||
class PasswordChangeDoneView(PasswordContextMixin, TemplateView):
|
class PasswordChangeDoneView(PasswordContextMixin, TemplateView):
|
||||||
template_name: str = ...
|
|
||||||
title: Any = ...
|
title: Any = ...
|
||||||
def dispatch(self, *args: Any, **kwargs: Any) -> TemplateResponse: ...
|
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
from django.db.models.base import Model
|
|
||||||
from typing import Any, List, Type
|
from typing import Any, List, Type
|
||||||
|
|
||||||
|
from django.contrib.admin.options import InlineModelAdmin
|
||||||
|
from django.db.models.base import Model
|
||||||
|
|
||||||
class GenericInlineModelAdminChecks:
|
class GenericInlineModelAdminChecks:
|
||||||
def _check_exclude_of_parent_model(self, obj: GenericTabularInline, parent_model: Type[Model]) -> List[Any]: ...
|
def _check_exclude_of_parent_model(self, obj: GenericInlineModelAdmin, parent_model: Type[Model]) -> List[Any]: ...
|
||||||
def _check_relation(self, obj: GenericTabularInline, parent_model: Type[Model]) -> List[Any]: ...
|
def _check_relation(self, obj: GenericInlineModelAdmin, parent_model: Type[Model]) -> List[Any]: ...
|
||||||
|
|
||||||
|
class GenericInlineModelAdmin(InlineModelAdmin):
|
||||||
|
template: str = ...
|
||||||
|
|
||||||
|
class GenericStackedInline(GenericInlineModelAdmin): ...
|
||||||
|
class GenericTabularInline(GenericInlineModelAdmin): ...
|
||||||
|
|||||||
@@ -1,16 +1,3 @@
|
|||||||
from typing import Any, Optional
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
from .management import create_contenttypes, inject_rename_contenttypes_operations
|
class ContentTypesConfig(AppConfig): ...
|
||||||
|
|
||||||
class ContentTypesConfig(AppConfig):
|
|
||||||
apps: None
|
|
||||||
label: str
|
|
||||||
models: None
|
|
||||||
models_module: None
|
|
||||||
module: Any
|
|
||||||
path: str
|
|
||||||
name: str = ...
|
|
||||||
verbose_name: Any = ...
|
|
||||||
def ready(self) -> None: ...
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
from typing import Any, List, Optional
|
from typing import Any, List, Optional, Sequence
|
||||||
|
|
||||||
def check_generic_foreign_keys(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
from django.apps.config import AppConfig
|
||||||
def check_model_name_lengths(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
|
||||||
|
def check_generic_foreign_keys(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Any]: ...
|
||||||
|
def check_model_name_lengths(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Any]: ...
|
||||||
|
|||||||
@@ -1,19 +1,24 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||||
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core.checks.messages import Error
|
from django.core.checks.messages import CheckMessage
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
|
from django.db.models.expressions import Combinable
|
||||||
|
from django.db.models.fields.mixins import FieldCacheMixin
|
||||||
from django.db.models.fields.related import ForeignObject
|
from django.db.models.fields.related import ForeignObject
|
||||||
from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor
|
from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor
|
||||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
from django.db.models.fields.reverse_related import ForeignObjectRel
|
||||||
|
|
||||||
from django.db.models.fields import Field, PositiveIntegerField
|
|
||||||
from django.db.models.fields.mixins import FieldCacheMixin
|
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.db.models.query_utils import FilteredRelation, PathInfo
|
from django.db.models.query_utils import FilteredRelation, PathInfo
|
||||||
from django.db.models.sql.where import WhereNode
|
from django.db.models.sql.where import WhereNode
|
||||||
|
|
||||||
|
from django.db.models.fields import Field, PositiveIntegerField
|
||||||
|
|
||||||
class GenericForeignKey(FieldCacheMixin):
|
class GenericForeignKey(FieldCacheMixin):
|
||||||
|
# django-stubs implementation only fields
|
||||||
|
_pyi_private_set_type: Union[Any, Combinable]
|
||||||
|
_pyi_private_get_type: Any
|
||||||
|
# attributes
|
||||||
auto_created: bool = ...
|
auto_created: bool = ...
|
||||||
concrete: bool = ...
|
concrete: bool = ...
|
||||||
editable: bool = ...
|
editable: bool = ...
|
||||||
@@ -36,7 +41,7 @@ class GenericForeignKey(FieldCacheMixin):
|
|||||||
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
|
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
|
||||||
def get_filter_kwargs_for_object(self, obj: Model) -> Dict[str, Optional[ContentType]]: ...
|
def get_filter_kwargs_for_object(self, obj: Model) -> Dict[str, Optional[ContentType]]: ...
|
||||||
def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ...
|
def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ...
|
||||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
def check(self, **kwargs: Any) -> List[CheckMessage]: ...
|
||||||
def get_cache_name(self) -> str: ...
|
def get_cache_name(self) -> str: ...
|
||||||
def get_content_type(
|
def get_content_type(
|
||||||
self, obj: Optional[Model] = ..., id: Optional[int] = ..., using: Optional[str] = ...
|
self, obj: Optional[Model] = ..., id: Optional[int] = ..., using: Optional[str] = ...
|
||||||
@@ -44,41 +49,27 @@ class GenericForeignKey(FieldCacheMixin):
|
|||||||
def get_prefetch_queryset(
|
def get_prefetch_queryset(
|
||||||
self, instances: Union[List[Model], QuerySet], queryset: Optional[QuerySet] = ...
|
self, instances: Union[List[Model], QuerySet], queryset: Optional[QuerySet] = ...
|
||||||
) -> Tuple[List[Model], Callable, Callable, bool, str, bool]: ...
|
) -> Tuple[List[Model], Callable, Callable, bool, str, bool]: ...
|
||||||
def __get__(
|
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Optional[Any]: ...
|
||||||
self, instance: Optional[Model], cls: Type[Model] = ...
|
def __set__(self, instance: Model, value: Optional[Any]) -> None: ...
|
||||||
) -> Optional[Union[GenericForeignKey, Model]]: ...
|
|
||||||
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
|
|
||||||
|
|
||||||
class GenericRel(ForeignObjectRel):
|
class GenericRel(ForeignObjectRel):
|
||||||
field: GenericRelation
|
field: GenericRelation
|
||||||
limit_choices_to: Dict[Any, Any]
|
|
||||||
model: Type[Model]
|
|
||||||
multiple: bool
|
|
||||||
on_delete: Callable
|
|
||||||
parent_link: bool
|
|
||||||
related_name: str
|
|
||||||
related_query_name: None
|
|
||||||
symmetrical: bool
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
field: GenericRelation,
|
field: GenericRelation,
|
||||||
to: Union[Type[Model], str],
|
to: Union[Type[Model], str],
|
||||||
related_name: None = ...,
|
related_name: Optional[str] = ...,
|
||||||
related_query_name: Optional[str] = ...,
|
related_query_name: Optional[str] = ...,
|
||||||
limit_choices_to: None = ...,
|
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
class GenericRelation(ForeignObject):
|
class GenericRelation(ForeignObject):
|
||||||
auto_created: bool = ...
|
|
||||||
many_to_many: bool = ...
|
|
||||||
many_to_one: bool = ...
|
|
||||||
one_to_many: bool = ...
|
|
||||||
one_to_one: bool = ...
|
|
||||||
rel_class: Any = ...
|
rel_class: Any = ...
|
||||||
mti_inherited: bool = ...
|
mti_inherited: bool = ...
|
||||||
object_id_field_name: Any = ...
|
object_id_field_name: Any = ...
|
||||||
content_type_field_name: Any = ...
|
content_type_field_name: Any = ...
|
||||||
for_concrete_model: Any = ...
|
for_concrete_model: Any = ...
|
||||||
|
to_fields: Any = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
to: Union[Type[Model], str],
|
to: Union[Type[Model], str],
|
||||||
@@ -86,28 +77,18 @@ class GenericRelation(ForeignObject):
|
|||||||
content_type_field: str = ...,
|
content_type_field: str = ...,
|
||||||
for_concrete_model: bool = ...,
|
for_concrete_model: bool = ...,
|
||||||
related_query_name: Optional[str] = ...,
|
related_query_name: Optional[str] = ...,
|
||||||
limit_choices_to: None = ...,
|
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ...,
|
||||||
**kwargs: Any
|
**kwargs: Any
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
|
||||||
to_fields: Any = ...
|
|
||||||
def resolve_related_fields(self) -> List[Tuple[PositiveIntegerField, Field]]: ...
|
def resolve_related_fields(self) -> List[Tuple[PositiveIntegerField, Field]]: ...
|
||||||
def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> List[PathInfo]: ...
|
def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> List[PathInfo]: ...
|
||||||
def get_reverse_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
|
def get_reverse_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
|
||||||
def value_to_string(self, obj: Model) -> str: ...
|
|
||||||
model: Any = ...
|
|
||||||
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
|
|
||||||
def set_attributes_from_rel(self) -> None: ...
|
|
||||||
def get_internal_type(self) -> str: ...
|
|
||||||
def get_content_type(self) -> ContentType: ...
|
def get_content_type(self) -> ContentType: ...
|
||||||
def get_extra_restriction(
|
def get_extra_restriction(
|
||||||
self, where_class: Type[WhereNode], alias: Optional[str], remote_alias: str
|
self, where_class: Type[WhereNode], alias: Optional[str], remote_alias: str
|
||||||
) -> WhereNode: ...
|
) -> WhereNode: ...
|
||||||
def bulk_related_objects(self, objs: List[Model], using: str = ...) -> QuerySet: ...
|
def bulk_related_objects(self, objs: List[Model], using: str = ...) -> QuerySet: ...
|
||||||
|
|
||||||
class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor):
|
class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor): ...
|
||||||
field: GenericRelation
|
|
||||||
rel: GenericRel
|
|
||||||
def related_manager_cls(self): ...
|
|
||||||
|
|
||||||
def create_generic_related_manager(superclass: Any, rel: Any): ...
|
def create_generic_related_manager(superclass: Any, rel: Any): ...
|
||||||
|
|||||||
@@ -1,20 +1,13 @@
|
|||||||
from typing import Any, Optional
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from django.core.management import BaseCommand
|
|
||||||
from django.core.management.base import CommandParser
|
|
||||||
from django.db.models.deletion import Collector
|
from django.db.models.deletion import Collector
|
||||||
|
|
||||||
from ...management import get_contenttypes_and_models
|
from django.core.management import BaseCommand
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand): ...
|
||||||
stderr: django.core.management.base.OutputWrapper
|
|
||||||
stdout: django.core.management.base.OutputWrapper
|
|
||||||
style: django.core.management.color.Style
|
|
||||||
def add_arguments(self, parser: CommandParser) -> None: ...
|
|
||||||
def handle(self, **options: Any) -> None: ...
|
|
||||||
|
|
||||||
class NoFastDeleteCollector(Collector):
|
class NoFastDeleteCollector(Collector):
|
||||||
data: collections.OrderedDict
|
data: Dict[str, Any]
|
||||||
dependencies: Dict[Any, Any]
|
dependencies: Dict[Any, Any]
|
||||||
fast_deletes: List[Any]
|
fast_deletes: List[Any]
|
||||||
field_updates: Dict[Any, Any]
|
field_updates: Dict[Any, Any]
|
||||||
|
|||||||
@@ -4,12 +4,7 @@ from django.db import models
|
|||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
|
||||||
class ContentTypeManager(models.Manager):
|
class ContentTypeManager(models.Manager["ContentType"]):
|
||||||
creation_counter: int
|
|
||||||
model: None
|
|
||||||
name: None
|
|
||||||
use_in_migrations: bool = ...
|
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
|
||||||
def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ...
|
def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ...
|
||||||
def get_for_model(self, model: Union[Type[Model], Model], for_concrete_model: bool = ...) -> ContentType: ...
|
def get_for_model(self, model: Union[Type[Model], Model], for_concrete_model: bool = ...) -> ContentType: ...
|
||||||
def get_for_models(self, *models: Any, for_concrete_models: bool = ...) -> Dict[Type[Model], ContentType]: ...
|
def get_for_models(self, *models: Any, for_concrete_models: bool = ...) -> Dict[Type[Model], ContentType]: ...
|
||||||
@@ -18,14 +13,9 @@ class ContentTypeManager(models.Manager):
|
|||||||
|
|
||||||
class ContentType(models.Model):
|
class ContentType(models.Model):
|
||||||
id: int
|
id: int
|
||||||
app_label: str = ...
|
app_label: models.CharField = ...
|
||||||
model: str = ...
|
model: models.CharField = ...
|
||||||
objects: Any = ...
|
objects: ContentTypeManager = ...
|
||||||
class Meta:
|
|
||||||
verbose_name: Any = ...
|
|
||||||
verbose_name_plural: Any = ...
|
|
||||||
db_table: str = ...
|
|
||||||
unique_together: Any = ...
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str: ...
|
def name(self) -> str: ...
|
||||||
def model_class(self) -> Optional[Type[Model]]: ...
|
def model_class(self) -> Optional[Type[Model]]: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Optional, Union
|
from typing import Union
|
||||||
|
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponseRedirect
|
from django.http.response import HttpResponseRedirect
|
||||||
|
|||||||
9
django-stubs/contrib/flatpages/admin.pyi
Normal file
9
django-stubs/contrib/flatpages/admin.pyi
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from django.contrib import admin as admin
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class FlatPageAdmin(admin.ModelAdmin):
|
||||||
|
form: Any = ...
|
||||||
|
fieldsets: Any = ...
|
||||||
|
list_display: Any = ...
|
||||||
|
list_filter: Any = ...
|
||||||
|
search_fields: Any = ...
|
||||||
6
django-stubs/contrib/flatpages/apps.pyi
Normal file
6
django-stubs/contrib/flatpages/apps.pyi
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig as AppConfig
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class FlatPagesConfig(AppConfig):
|
||||||
|
name: str = ...
|
||||||
|
verbose_name: Any = ...
|
||||||
@@ -1,22 +1,7 @@
|
|||||||
from typing import Any, Dict, Optional, Union
|
from typing import Any
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.db.models.query import QuerySet
|
|
||||||
|
|
||||||
class FlatpageForm(forms.ModelForm):
|
class FlatpageForm(forms.ModelForm):
|
||||||
auto_id: str
|
|
||||||
data: Dict[str, Union[List[int], str]]
|
|
||||||
empty_permitted: bool
|
|
||||||
error_class: Type[ErrorList]
|
|
||||||
fields: collections.OrderedDict
|
|
||||||
files: Dict[Any, Any]
|
|
||||||
initial: Dict[str, Union[List[django.contrib.sites.models.Site], int, str]]
|
|
||||||
instance: django.contrib.flatpages.models.FlatPage
|
|
||||||
is_bound: bool
|
|
||||||
label_suffix: str
|
|
||||||
url: Any = ...
|
url: Any = ...
|
||||||
class Meta:
|
|
||||||
model: Any = ...
|
|
||||||
fields: str = ...
|
|
||||||
def clean_url(self) -> str: ...
|
def clean_url(self) -> str: ...
|
||||||
def clean(self) -> Dict[str, Union[bool, QuerySet, str]]: ...
|
|
||||||
|
|||||||
@@ -1,19 +1,13 @@
|
|||||||
from typing import Any, Optional
|
from django.contrib.sites.models import Site
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
class FlatPage(models.Model):
|
class FlatPage(models.Model):
|
||||||
id: None
|
url: models.CharField = ...
|
||||||
url: str = ...
|
title: models.CharField = ...
|
||||||
title: str = ...
|
content: models.TextField = ...
|
||||||
content: str = ...
|
enable_comments: models.BooleanField = ...
|
||||||
enable_comments: bool = ...
|
template_name: models.CharField = ...
|
||||||
template_name: str = ...
|
registration_required: models.BooleanField = ...
|
||||||
registration_required: bool = ...
|
sites: models.ManyToManyField[Site, Site] = ...
|
||||||
sites: Any = ...
|
|
||||||
class Meta:
|
|
||||||
db_table: str = ...
|
|
||||||
verbose_name: Any = ...
|
|
||||||
verbose_name_plural: Any = ...
|
|
||||||
ordering: Any = ...
|
|
||||||
def get_absolute_url(self) -> str: ...
|
def get_absolute_url(self) -> str: ...
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
from typing import Optional
|
|
||||||
|
|
||||||
from django.contrib.sitemaps import Sitemap
|
from django.contrib.sitemaps import Sitemap
|
||||||
from django.db.models.query import QuerySet
|
|
||||||
|
|
||||||
class FlatPageSitemap(Sitemap):
|
class FlatPageSitemap(Sitemap): ...
|
||||||
def items(self) -> QuerySet: ...
|
|
||||||
|
|||||||
3
django-stubs/contrib/flatpages/urls.pyi
Normal file
3
django-stubs/contrib/flatpages/urls.pyi
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from typing import Any, List
|
||||||
|
|
||||||
|
urlpatterns: List[Any] = ...
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
from typing import Any, Optional
|
|
||||||
|
|
||||||
from django.contrib.flatpages.models import FlatPage
|
from django.contrib.flatpages.models import FlatPage
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
|
|||||||
1
django-stubs/contrib/gis/__init__.pyi
Normal file
1
django-stubs/contrib/gis/__init__.pyi
Normal file
@@ -0,0 +1 @@
|
|||||||
|
default_app_config: str
|
||||||
12
django-stubs/contrib/gis/admin/__init__.pyi
Normal file
12
django-stubs/contrib/gis/admin/__init__.pyi
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from django.contrib.admin import (
|
||||||
|
AdminSite as AdminSite,
|
||||||
|
HORIZONTAL as HORIZONTAL,
|
||||||
|
ModelAdmin as ModelAdmin,
|
||||||
|
StackedInline as StackedInline,
|
||||||
|
TabularInline as TabularInline,
|
||||||
|
VERTICAL as VERTICAL,
|
||||||
|
autodiscover as autodiscover,
|
||||||
|
register as register,
|
||||||
|
site as site,
|
||||||
|
)
|
||||||
|
from django.contrib.gis.admin.options import GeoModelAdmin as GeoModelAdmin, OSMGeoAdmin as OSMGeoAdmin
|
||||||
45
django-stubs/contrib/gis/admin/options.pyi
Normal file
45
django-stubs/contrib/gis/admin/options.pyi
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
from django.contrib.admin import ModelAdmin as ModelAdmin
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
spherical_mercator_srid: int
|
||||||
|
|
||||||
|
class GeoModelAdmin(ModelAdmin):
|
||||||
|
default_lon: int = ...
|
||||||
|
default_lat: int = ...
|
||||||
|
default_zoom: int = ...
|
||||||
|
display_wkt: bool = ...
|
||||||
|
display_srid: bool = ...
|
||||||
|
extra_js: Any = ...
|
||||||
|
num_zoom: int = ...
|
||||||
|
max_zoom: bool = ...
|
||||||
|
min_zoom: bool = ...
|
||||||
|
units: bool = ...
|
||||||
|
max_resolution: bool = ...
|
||||||
|
max_extent: bool = ...
|
||||||
|
modifiable: bool = ...
|
||||||
|
mouse_position: bool = ...
|
||||||
|
scale_text: bool = ...
|
||||||
|
layerswitcher: bool = ...
|
||||||
|
scrollable: bool = ...
|
||||||
|
map_width: int = ...
|
||||||
|
map_height: int = ...
|
||||||
|
map_srid: int = ...
|
||||||
|
map_template: str = ...
|
||||||
|
openlayers_url: str = ...
|
||||||
|
point_zoom: Any = ...
|
||||||
|
wms_url: str = ...
|
||||||
|
wms_layer: str = ...
|
||||||
|
wms_name: str = ...
|
||||||
|
wms_options: Any = ...
|
||||||
|
debug: bool = ...
|
||||||
|
widget: Any = ...
|
||||||
|
@property
|
||||||
|
def media(self): ...
|
||||||
|
def formfield_for_dbfield(self, db_field: Any, request: Any, **kwargs: Any): ...
|
||||||
|
def get_map_widget(self, db_field: Any): ...
|
||||||
|
|
||||||
|
class OSMGeoAdmin(GeoModelAdmin):
|
||||||
|
map_template: str = ...
|
||||||
|
num_zoom: int = ...
|
||||||
|
map_srid: Any = ...
|
||||||
|
point_zoom: Any = ...
|
||||||
9
django-stubs/contrib/gis/admin/widgets.pyi
Normal file
9
django-stubs/contrib/gis/admin/widgets.pyi
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from django.forms.widgets import Textarea as Textarea
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
geo_context: Any
|
||||||
|
logger: Any
|
||||||
|
|
||||||
|
class OpenLayersWidget(Textarea):
|
||||||
|
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||||
|
def map_options(self): ...
|
||||||
7
django-stubs/contrib/gis/apps.pyi
Normal file
7
django-stubs/contrib/gis/apps.pyi
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from django.apps import AppConfig as AppConfig
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class GISConfig(AppConfig):
|
||||||
|
name: str = ...
|
||||||
|
verbose_name: Any = ...
|
||||||
|
def ready(self) -> None: ...
|
||||||
0
django-stubs/contrib/gis/db/__init__.pyi
Normal file
0
django-stubs/contrib/gis/db/__init__.pyi
Normal file
0
django-stubs/contrib/gis/db/backends/__init__.pyi
Normal file
0
django-stubs/contrib/gis/db/backends/__init__.pyi
Normal file
8
django-stubs/contrib/gis/db/backends/base/adapter.pyi
Normal file
8
django-stubs/contrib/gis/db/backends/base/adapter.pyi
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class WKTAdapter:
|
||||||
|
wkt: Any = ...
|
||||||
|
srid: Any = ...
|
||||||
|
def __init__(self, geom: Any) -> None: ...
|
||||||
|
def __eq__(self, other: Any) -> Any: ...
|
||||||
|
def __hash__(self) -> Any: ...
|
||||||
44
django-stubs/contrib/gis/db/backends/base/features.pyi
Normal file
44
django-stubs/contrib/gis/db/backends/base/features.pyi
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class BaseSpatialFeatures:
|
||||||
|
gis_enabled: bool = ...
|
||||||
|
has_spatialrefsys_table: bool = ...
|
||||||
|
supports_add_srs_entry: bool = ...
|
||||||
|
supports_geometry_field_introspection: bool = ...
|
||||||
|
supports_3d_storage: bool = ...
|
||||||
|
supports_3d_functions: bool = ...
|
||||||
|
supports_transform: bool = ...
|
||||||
|
supports_null_geometries: bool = ...
|
||||||
|
supports_empty_geometries: bool = ...
|
||||||
|
supports_distance_geodetic: bool = ...
|
||||||
|
supports_length_geodetic: bool = ...
|
||||||
|
supports_perimeter_geodetic: bool = ...
|
||||||
|
supports_area_geodetic: bool = ...
|
||||||
|
supports_num_points_poly: bool = ...
|
||||||
|
supports_left_right_lookups: bool = ...
|
||||||
|
supports_dwithin_distance_expr: bool = ...
|
||||||
|
supports_raster: bool = ...
|
||||||
|
supports_geometry_field_unique_index: bool = ...
|
||||||
|
@property
|
||||||
|
def supports_bbcontains_lookup(self): ...
|
||||||
|
@property
|
||||||
|
def supports_contained_lookup(self): ...
|
||||||
|
@property
|
||||||
|
def supports_crosses_lookup(self): ...
|
||||||
|
@property
|
||||||
|
def supports_distances_lookups(self): ...
|
||||||
|
@property
|
||||||
|
def supports_dwithin_lookup(self): ...
|
||||||
|
@property
|
||||||
|
def supports_relate_lookup(self): ...
|
||||||
|
@property
|
||||||
|
def supports_isvalid_lookup(self): ...
|
||||||
|
@property
|
||||||
|
def supports_collect_aggr(self): ...
|
||||||
|
@property
|
||||||
|
def supports_extent_aggr(self): ...
|
||||||
|
@property
|
||||||
|
def supports_make_line_aggr(self): ...
|
||||||
|
@property
|
||||||
|
def supports_union_aggr(self): ...
|
||||||
|
def __getattr__(self, name: Any): ...
|
||||||
33
django-stubs/contrib/gis/db/backends/base/models.pyi
Normal file
33
django-stubs/contrib/gis/db/backends/base/models.pyi
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class SpatialRefSysMixin:
|
||||||
|
@property
|
||||||
|
def srs(self): ...
|
||||||
|
@property
|
||||||
|
def ellipsoid(self): ...
|
||||||
|
@property
|
||||||
|
def name(self): ...
|
||||||
|
@property
|
||||||
|
def spheroid(self): ...
|
||||||
|
@property
|
||||||
|
def datum(self): ...
|
||||||
|
@property
|
||||||
|
def projected(self): ...
|
||||||
|
@property
|
||||||
|
def local(self): ...
|
||||||
|
@property
|
||||||
|
def geographic(self): ...
|
||||||
|
@property
|
||||||
|
def linear_name(self): ...
|
||||||
|
@property
|
||||||
|
def linear_units(self): ...
|
||||||
|
@property
|
||||||
|
def angular_name(self): ...
|
||||||
|
@property
|
||||||
|
def angular_units(self): ...
|
||||||
|
@property
|
||||||
|
def units(self): ...
|
||||||
|
@classmethod
|
||||||
|
def get_units(cls, wkt: Any): ...
|
||||||
|
@classmethod
|
||||||
|
def get_spheroid(cls, wkt: Any, string: bool = ...): ...
|
||||||
33
django-stubs/contrib/gis/db/backends/base/operations.pyi
Normal file
33
django-stubs/contrib/gis/db/backends/base/operations.pyi
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class BaseSpatialOperations:
|
||||||
|
postgis: bool = ...
|
||||||
|
spatialite: bool = ...
|
||||||
|
mysql: bool = ...
|
||||||
|
oracle: bool = ...
|
||||||
|
spatial_version: Any = ...
|
||||||
|
select: str = ...
|
||||||
|
def select_extent(self): ...
|
||||||
|
geography: bool = ...
|
||||||
|
geometry: bool = ...
|
||||||
|
disallowed_aggregates: Any = ...
|
||||||
|
geom_func_prefix: str = ...
|
||||||
|
function_names: Any = ...
|
||||||
|
unsupported_functions: Any = ...
|
||||||
|
from_text: bool = ...
|
||||||
|
def convert_extent(self, box: Any, srid: Any) -> None: ...
|
||||||
|
def convert_extent3d(self, box: Any, srid: Any) -> None: ...
|
||||||
|
def geo_quote_name(self, name: Any): ...
|
||||||
|
def geo_db_type(self, f: Any) -> None: ...
|
||||||
|
def get_distance(self, f: Any, value: Any, lookup_type: Any) -> None: ...
|
||||||
|
def get_geom_placeholder(self, f: Any, value: Any, compiler: Any): ...
|
||||||
|
def check_expression_support(self, expression: Any) -> None: ...
|
||||||
|
def spatial_aggregate_name(self, agg_name: Any) -> None: ...
|
||||||
|
def spatial_function_name(self, func_name: Any): ...
|
||||||
|
def geometry_columns(self) -> None: ...
|
||||||
|
def spatial_ref_sys(self) -> None: ...
|
||||||
|
distance_expr_for_lookup: Any = ...
|
||||||
|
def get_db_converters(self, expression: Any): ...
|
||||||
|
def get_geometry_converter(self, expression: Any) -> None: ...
|
||||||
|
def get_area_att_for_field(self, field: Any): ...
|
||||||
|
def get_distance_att_for_field(self, field: Any): ...
|
||||||
8
django-stubs/contrib/gis/db/backends/mysql/base.pyi
Normal file
8
django-stubs/contrib/gis/db/backends/mysql/base.pyi
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class DatabaseWrapper(MySQLDatabaseWrapper):
|
||||||
|
SchemaEditorClass: Any = ...
|
||||||
|
features_class: Any = ...
|
||||||
|
introspection_class: Any = ...
|
||||||
|
ops_class: Any = ...
|
||||||
14
django-stubs/contrib/gis/db/backends/mysql/features.pyi
Normal file
14
django-stubs/contrib/gis/db/backends/mysql/features.pyi
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures as BaseSpatialFeatures
|
||||||
|
from django.db.backends.mysql.features import DatabaseFeatures as MySQLDatabaseFeatures
|
||||||
|
|
||||||
|
class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures):
|
||||||
|
has_spatialrefsys_table: bool = ...
|
||||||
|
supports_add_srs_entry: bool = ...
|
||||||
|
supports_distance_geodetic: bool = ...
|
||||||
|
supports_length_geodetic: bool = ...
|
||||||
|
supports_area_geodetic: bool = ...
|
||||||
|
supports_transform: bool = ...
|
||||||
|
supports_null_geometries: bool = ...
|
||||||
|
supports_num_points_poly: bool = ...
|
||||||
|
def supports_empty_geometry_collection(self): ...
|
||||||
|
def supports_geometry_field_unique_index(self): ...
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
from django.db.backends.mysql.introspection import DatabaseIntrospection as DatabaseIntrospection
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class MySQLIntrospection(DatabaseIntrospection):
|
||||||
|
data_types_reverse: Any = ...
|
||||||
|
def get_geometry_type(self, table_name: Any, description: Any): ...
|
||||||
|
def supports_spatial_index(self, cursor: Any, table_name: Any): ...
|
||||||
17
django-stubs/contrib/gis/db/backends/mysql/operations.pyi
Normal file
17
django-stubs/contrib/gis/db/backends/mysql/operations.pyi
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations as BaseSpatialOperations
|
||||||
|
from django.db.backends.mysql.operations import DatabaseOperations as DatabaseOperations
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
|
||||||
|
mysql: bool = ...
|
||||||
|
name: str = ...
|
||||||
|
geom_func_prefix: str = ...
|
||||||
|
Adapter: Any = ...
|
||||||
|
def select(self): ...
|
||||||
|
def from_text(self): ...
|
||||||
|
def gis_operators(self): ...
|
||||||
|
disallowed_aggregates: Any = ...
|
||||||
|
def unsupported_functions(self): ...
|
||||||
|
def geo_db_type(self, f: Any): ...
|
||||||
|
def get_distance(self, f: Any, value: Any, lookup_type: Any): ...
|
||||||
|
def get_geometry_converter(self, expression: Any): ...
|
||||||
16
django-stubs/contrib/gis/db/backends/mysql/schema.pyi
Normal file
16
django-stubs/contrib/gis/db/backends/mysql/schema.pyi
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
from django.db.backends.mysql.schema import DatabaseSchemaEditor as DatabaseSchemaEditor
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
logger: Any
|
||||||
|
|
||||||
|
class MySQLGISSchemaEditor(DatabaseSchemaEditor):
|
||||||
|
sql_add_spatial_index: str = ...
|
||||||
|
sql_drop_spatial_index: str = ...
|
||||||
|
geometry_sql: Any = ...
|
||||||
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
|
def skip_default(self, field: Any): ...
|
||||||
|
def column_sql(self, model: Any, field: Any, include_default: bool = ...): ...
|
||||||
|
def create_model(self, model: Any) -> None: ...
|
||||||
|
def add_field(self, model: Any, field: Any) -> None: ...
|
||||||
|
def remove_field(self, model: Any, field: Any) -> None: ...
|
||||||
|
def create_spatial_indexes(self) -> None: ...
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user