mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
Compare commits
151 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
53
.travis.yml
53
.travis.yml
@@ -1,31 +1,48 @@
|
||||
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: 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: Run plugin test suite with python 3.6
|
||||
python: 3.6
|
||||
script: |
|
||||
set -e
|
||||
pytest
|
||||
|
||||
# - name: "Typecheck Django test suite"
|
||||
# python: 3.7
|
||||
# script: |
|
||||
# xonsh ./scripts/typecheck_django_tests.xsh
|
||||
- name: Typecheck Django test suite
|
||||
python: 3.7
|
||||
script: 'python ./scripts/typecheck_tests.py'
|
||||
|
||||
- name: Lint with black
|
||||
python: 3.7
|
||||
script: 'black --check --line-length=120 django-stubs/'
|
||||
|
||||
- name: Lint plugin code with flake8
|
||||
python: 3.7
|
||||
script: 'flake8'
|
||||
|
||||
- name: Lint plugin code with isort
|
||||
python: 3.7
|
||||
script: 'isort --check'
|
||||
|
||||
before_install: |
|
||||
# Upgrade pip, setuptools, and wheel
|
||||
pip install -U pip setuptools wheel xonsh
|
||||
|
||||
pip install -U pip setuptools wheel
|
||||
install: |
|
||||
pip install -r ./dev-requirements.txt
|
||||
pip install -r ./scripts/typecheck-tests-requirements.txt
|
||||
|
||||
#deploy:
|
||||
# provider: pypi
|
||||
# user: "mkurnikov"
|
||||
# password:
|
||||
# secure: 0E+hkaIdtpEtyL1KZeglunZ5/PKjouFfa8ljakAwoig7VNUL+2sO/bTyg38wRQl0NvzDzEHSMEt1bzg4Tq7b7Zp6nLuewG/w7mGLzqaOlTySiPEfRsg8s6uO2KrTn7g9VhlXH6UtyTXoQdMt6aE8+bt/GmEesanS57NB2mhwmylFgQwlJFu4LfIv/+aGmc4eLeGI2Qhvs9QYf7qvYlLQldgFh8mAckQEEvaBg35sf+puypZgf4nkx1k/dfG9wnFWZU8PJ41LbMw/Wj+k/9NpF8ePwiAr0fvRMErZd8nvoiWjQQjhzgrLVHhXEP5pTHh3zjDuGFMWyKuBhC6WLsG4qOQz/HvxeYvNI+jaTp15BgxtefG/pCNDUl/8GlCde7xVt7xzEcYNJSRaZPY2oofEFSd9qDnr4kqmyCXpNsaHRHvkL61bFjXUcfOsMMYvQCC6N2Jjb7S97RbnDdkOZO/lnFhVANT2rigsaXlSlWyN6f7ApxDNvu6Ehu5yrx6IjlPZJ0sI9vvY3IoS6Fik7w9E6zjNVjbmUn1D4MKFP4v5ppNASOqYcZeLd42j8rjEp0gIc3ccz9aUIT9q8VqSXSdUbqA6SVwvHXIVPxJMXj0bqWBG1iKs0cPBuzRVpRrwkENWCSWElDAewM1qFEnK0LppyoYFbqoQ8F5FG0+re7QttKQ=
|
||||
# on:
|
||||
# tags: true
|
||||
25
LICENSE.txt
25
LICENSE.txt
@@ -1,27 +1,8 @@
|
||||
Copyright (c) Maxim Kurnikov.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
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.
|
||||
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.
|
||||
|
||||
33
README.md
33
README.md
@@ -7,12 +7,14 @@
|
||||
|
||||
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.
|
||||
|
||||
Supports Python 3.6/3.7, and Django 2.1.x series.
|
||||
|
||||
Could be run on earlier versions of Django, but expect some missing imports warnings.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
git clone https://github.com/mkurnikov/django-stubs.git
|
||||
cd django-stubs
|
||||
pip install -U .
|
||||
pip install django-stubs
|
||||
```
|
||||
|
||||
To make mypy aware of the plugin, you need to add
|
||||
@@ -25,4 +27,27 @@ plugins =
|
||||
|
||||
in your `mypy.ini` file.
|
||||
|
||||
Also, it uses value of `DJANGO_SETTINGS_MODULE` from the environment, so set it before execution, otherwise some features will not work.
|
||||
|
||||
## Configuration
|
||||
|
||||
In order to specify config file, set `MYPY_DJANGO_CONFIG` environment variable with path to the config file. Default is `./mypy_django.ini`
|
||||
|
||||
Config file format (.ini):
|
||||
```
|
||||
[mypy_django_plugin]
|
||||
|
||||
# specify settings module to use for django.conf.settings, this setting
|
||||
# could also be specified with DJANGO_SETTINGS_MODULE environment variable
|
||||
# (it also takes priority over config file)
|
||||
django_settings = mysettings.local
|
||||
|
||||
# if True, all unknown settings in django.conf.settings will fallback to Any,
|
||||
# specify it if your settings are loaded dynamically to avoid false positives
|
||||
ignore_missing_settings = True
|
||||
```
|
||||
|
||||
## 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.
|
||||
@@ -1,3 +1,5 @@
|
||||
black
|
||||
-e git+https://github.com/mkurnikov/pytest-mypy-plugins.git#egg=pytest-mypy-plugins
|
||||
pytest-mypy-plugins
|
||||
flake8
|
||||
isort==4.3.4
|
||||
-e .
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from typing import Any
|
||||
from .utils.version import get_version as get_version
|
||||
|
||||
VERSION: Any
|
||||
__version__: str
|
||||
|
||||
def setup(set_prefix: bool = ...) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Iterator, Type
|
||||
from typing import Any, Iterator, Type, Optional, Dict
|
||||
|
||||
from django.db.models.base import Model
|
||||
|
||||
@@ -6,14 +6,14 @@ MODELS_MODULE_NAME: str
|
||||
|
||||
class AppConfig:
|
||||
name: str = ...
|
||||
module: Any = ...
|
||||
module: Optional[Any] = ...
|
||||
apps: None = ...
|
||||
label: str = ...
|
||||
verbose_name: str = ...
|
||||
path: str = ...
|
||||
models_module: None = ...
|
||||
models: None = ...
|
||||
def __init__(self, app_name: str, app_module: None) -> None: ...
|
||||
models: Dict[str, Type[Model]] = ...
|
||||
def __init__(self, app_name: str, app_module: Optional[Any]) -> None: ...
|
||||
@classmethod
|
||||
def create(cls, entry: str) -> AppConfig: ...
|
||||
def get_model(self, model_name: str, require_ready: bool = ...) -> Type[Model]: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import collections
|
||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union, Iterable
|
||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union, Iterable, DefaultDict
|
||||
|
||||
from django.db.migrations.state import AppConfigStub
|
||||
from django.db.models.base import Model
|
||||
@@ -12,6 +12,7 @@ class Apps:
|
||||
stored_app_configs: List[Any] = ...
|
||||
apps_ready: bool = ...
|
||||
loading: bool = ...
|
||||
_pending_operations: DefaultDict[Tuple[str, str], List]
|
||||
def __init__(self, installed_apps: Optional[Union[List[AppConfigStub], List[str], Tuple]] = ...) -> None: ...
|
||||
models_ready: bool = ...
|
||||
ready: bool = ...
|
||||
|
||||
@@ -2,6 +2,8 @@ from typing import Any
|
||||
|
||||
from django.utils.functional import LazyObject
|
||||
|
||||
ENVIRONMENT_VARIABLE: str = ...
|
||||
|
||||
# required for plugin to be able to distinguish this specific instance of LazySettings from others
|
||||
class _DjangoConfLazyObject(LazyObject): ...
|
||||
|
||||
@@ -11,5 +13,8 @@ class LazySettings(_DjangoConfLazyObject):
|
||||
|
||||
settings: LazySettings = ...
|
||||
|
||||
class Settings: ...
|
||||
class Settings:
|
||||
def __init__(self, settings_module: str): ...
|
||||
def is_overridden(self, setting: str) -> bool: ...
|
||||
|
||||
class UserSettingsHolder: ...
|
||||
|
||||
507
django-stubs/conf/global_settings.pyi
Normal file
507
django-stubs/conf/global_settings.pyi
Normal file
@@ -0,0 +1,507 @@
|
||||
"""
|
||||
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, Tuple, Protocol, Union, Callable, TYPE_CHECKING, Sequence
|
||||
|
||||
####################
|
||||
# CORE #
|
||||
####################
|
||||
if TYPE_CHECKING:
|
||||
from django.db.models.base import Model
|
||||
|
||||
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, Callable[[Model], str]] = ...
|
||||
|
||||
# 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 = "Lax"
|
||||
# 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 = "Lax"
|
||||
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
|
||||
@@ -1,20 +1,22 @@
|
||||
# Stubs for django.conf.urls (Python 3.5)
|
||||
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
|
||||
|
||||
handler400 = ... # type: str
|
||||
handler403 = ... # type: str
|
||||
handler404 = ... # type: str
|
||||
handler500 = ... # type: str
|
||||
handler400: Callable[..., HttpResponse] = ...
|
||||
handler403: Callable[..., HttpResponse] = ...
|
||||
handler404: Callable[..., HttpResponse] = ...
|
||||
handler500: Callable[..., HttpResponse] = ...
|
||||
|
||||
IncludedURLConf = Tuple[List[URLResolver], Optional[str], Optional[str]]
|
||||
|
||||
def include(arg: Any, namespace: str = ..., app_name: str = ...) -> IncludedURLConf: ...
|
||||
@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
|
||||
def url(regex: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ...) -> URLResolver: ...
|
||||
@overload
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.contrib.admin.decorators import register as register
|
||||
from django.contrib.admin.filters import (
|
||||
from .decorators import register as register
|
||||
from .filters import (
|
||||
AllValuesFieldListFilter as AllValuesFieldListFilter,
|
||||
BooleanFieldListFilter as BooleanFieldListFilter,
|
||||
ChoicesFieldListFilter as ChoicesFieldListFilter,
|
||||
@@ -10,14 +10,15 @@ from django.contrib.admin.filters import (
|
||||
RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter,
|
||||
SimpleListFilter as SimpleListFilter,
|
||||
)
|
||||
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME as ACTION_CHECKBOX_NAME
|
||||
from django.contrib.admin.options import (
|
||||
from .helpers import ACTION_CHECKBOX_NAME as ACTION_CHECKBOX_NAME
|
||||
from .options import (
|
||||
HORIZONTAL as HORIZONTAL,
|
||||
VERTICAL as VERTICAL,
|
||||
ModelAdmin as ModelAdmin,
|
||||
StackedInline as StackedInline,
|
||||
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: ...
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
from typing import Any, List
|
||||
from typing import Any, List, Union
|
||||
|
||||
from django.contrib.admin.options import BaseModelAdmin, InlineModelAdmin, ModelAdmin
|
||||
from django.core.checks.messages import Error
|
||||
|
||||
def check_admin_app(app_configs: None, **kwargs: Any) -> List[str]: ...
|
||||
def check_dependencies(**kwargs: Any) -> List[Error]: ...
|
||||
_CheckError = Union[str, Error]
|
||||
|
||||
def check_admin_app(app_configs: None, **kwargs: Any) -> List[_CheckError]: ...
|
||||
def check_dependencies(**kwargs: Any) -> List[_CheckError]: ...
|
||||
|
||||
class BaseModelAdminChecks:
|
||||
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> List[Error]: ...
|
||||
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> List[_CheckError]: ...
|
||||
|
||||
class ModelAdminChecks(BaseModelAdminChecks):
|
||||
def check(self, admin_obj: ModelAdmin, **kwargs: Any) -> List[Error]: ...
|
||||
|
||||
class InlineModelAdminChecks(BaseModelAdminChecks):
|
||||
def check(self, inline_obj: InlineModelAdmin, **kwargs: Any) -> List[Any]: ...
|
||||
class ModelAdminChecks(BaseModelAdminChecks): ...
|
||||
class InlineModelAdminChecks(BaseModelAdminChecks): ...
|
||||
|
||||
def must_be(type: Any, option: Any, obj: Any, id: Any): ...
|
||||
def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any): ...
|
||||
|
||||
@@ -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.core.handlers.wsgi import WSGIRequest
|
||||
@@ -16,7 +16,7 @@ class ListFilter:
|
||||
self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin
|
||||
) -> None: ...
|
||||
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 expected_parameters(self) -> Optional[List[str]]: ...
|
||||
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from typing import Any, Optional, Union
|
||||
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 import models
|
||||
|
||||
ADDITION: int
|
||||
CHANGE: int
|
||||
DELETION: int
|
||||
ACTION_FLAG_CHOICES: Any
|
||||
|
||||
class LogEntryManager(models.Manager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
class LogEntryManager(models.Manager["LogEntry"]):
|
||||
def log_action(
|
||||
self,
|
||||
user_id: int,
|
||||
@@ -22,28 +19,18 @@ class LogEntryManager(models.Manager):
|
||||
object_id: Union[int, str, UUID],
|
||||
object_repr: str,
|
||||
action_flag: int,
|
||||
change_message: Union[
|
||||
Dict[str, Dict[str, List[str]]], List[Dict[str, Dict[str, Union[List[str], str]]]], str
|
||||
] = ...,
|
||||
change_message: Any = ...,
|
||||
) -> LogEntry: ...
|
||||
|
||||
class LogEntry(models.Model):
|
||||
content_type_id: int
|
||||
id: None
|
||||
user_id: int
|
||||
action_time: datetime.datetime = ...
|
||||
user: Any = ...
|
||||
content_type: Any = ...
|
||||
object_id: str = ...
|
||||
object_repr: str = ...
|
||||
action_flag: int = ...
|
||||
change_message: str = ...
|
||||
objects: Any = ...
|
||||
class Meta:
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
db_table: str = ...
|
||||
ordering: Any = ...
|
||||
action_time: models.DateTimeField = ...
|
||||
user: models.ForeignKey = ...
|
||||
content_type: models.ForeignKey = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
||||
object_id: models.TextField = ...
|
||||
object_repr: models.CharField = ...
|
||||
action_flag: models.PositiveSmallIntegerField = ...
|
||||
change_message: models.TextField = ...
|
||||
objects: LogEntryManager = ...
|
||||
def is_addition(self) -> bool: ...
|
||||
def is_change(self) -> bool: ...
|
||||
def is_deletion(self) -> bool: ...
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, Union
|
||||
|
||||
from django.contrib.admin.filters import SimpleListFilter
|
||||
from django.contrib.admin.filters import ListFilter
|
||||
from django.contrib.admin.models import LogEntry
|
||||
from django.contrib.admin.sites import AdminSite
|
||||
from django.contrib.admin.views.main import ChangeList
|
||||
from django.contrib.auth.forms import AdminPasswordChangeForm
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.paginator import Paginator
|
||||
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.options import Options
|
||||
from django.db.models.query import QuerySet
|
||||
from django.forms.fields import TypedChoiceField
|
||||
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
|
||||
from django.forms.widgets import Media
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse
|
||||
from django.template.response import TemplateResponse
|
||||
from django.urls.resolvers import URLPattern
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from django.db.models.options import Options
|
||||
from django.db.models.fields import Field
|
||||
|
||||
IS_POPUP_VAR: str
|
||||
TO_FIELD_VAR: str
|
||||
@@ -55,60 +55,61 @@ class BaseModelAdmin:
|
||||
view_on_site: bool = ...
|
||||
show_full_result_count: bool = ...
|
||||
checks_class: Any = ...
|
||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||
def check(self, **kwargs: Any) -> List[Union[str, Error]]: ...
|
||||
def __init__(self) -> None: ...
|
||||
def formfield_for_dbfield(self, db_field: Field, request: WSGIRequest, **kwargs: Any) -> Optional[Field]: ...
|
||||
def formfield_for_choice_field(self, db_field: Field, request: WSGIRequest, **kwargs: Any) -> TypedChoiceField: ...
|
||||
def get_field_queryset(self, db: None, db_field: RelatedField, request: WSGIRequest) -> Optional[QuerySet]: ...
|
||||
def formfield_for_dbfield(
|
||||
self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any
|
||||
) -> Optional[Field]: ...
|
||||
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(
|
||||
self, db_field: ForeignKey, request: WSGIRequest, **kwargs: Any
|
||||
self, db_field: ForeignKey, request: Optional[HttpRequest], **kwargs: Any
|
||||
) -> Optional[ModelChoiceField]: ...
|
||||
def formfield_for_manytomany(
|
||||
self, db_field: ManyToManyField, request: WSGIRequest, **kwargs: Any
|
||||
self, db_field: ManyToManyField, request: Optional[HttpRequest], **kwargs: Any
|
||||
) -> 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_empty_value_display(self) -> SafeText: ...
|
||||
def get_exclude(self, request: WSGIRequest, obj: Optional[Model] = ...) -> None: ...
|
||||
def get_fields(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> Union[List[Union[Callable, str]], Tuple[str, str]]: ...
|
||||
def get_exclude(self, request: HttpRequest, obj: Optional[Model] = ...) -> Any: ...
|
||||
def get_fields(self, request: HttpRequest, obj: Optional[Model] = ...) -> Sequence[Union[Callable, str]]: ...
|
||||
def get_fieldsets(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> Union[
|
||||
List[Tuple[None, Dict[str, List[Union[Callable, str]]]]],
|
||||
Tuple[Tuple[Optional[str], Dict[str, Tuple[Union[Tuple[str, str], str]]]]],
|
||||
]: ...
|
||||
def get_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
|
||||
def get_readonly_fields(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Union[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]: ...
|
||||
self, request: HttpRequest, obj: Optional[Model] = ...
|
||||
) -> List[Tuple[Optional[str], Dict[str, Any]]]: ...
|
||||
def get_ordering(self, request: HttpRequest) -> Union[List[str], Tuple]: ...
|
||||
def get_readonly_fields(self, request: HttpRequest, obj: Optional[Model] = ...) -> Union[List[str], Tuple]: ...
|
||||
def get_prepopulated_fields(self, request: HttpRequest, obj: Optional[Model] = ...) -> Dict[str, Tuple[str]]: ...
|
||||
def get_queryset(self, request: HttpRequest) -> QuerySet: ...
|
||||
def get_sortable_by(self, request: HttpRequest) -> Union[List[Callable], List[str], Tuple]: ...
|
||||
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
|
||||
def to_field_allowed(self, request: WSGIRequest, to_field: str) -> bool: ...
|
||||
def has_add_permission(self, request: WSGIRequest) -> bool: ...
|
||||
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: ...
|
||||
def has_module_permission(self, request: WSGIRequest) -> bool: ...
|
||||
def to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ...
|
||||
def has_add_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
|
||||
def has_change_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
|
||||
def has_delete_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
|
||||
def has_view_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
|
||||
def has_module_permission(self, request: HttpRequest) -> bool: ...
|
||||
|
||||
class ModelAdmin(BaseModelAdmin):
|
||||
formfield_overrides: Any
|
||||
list_display: Any = ...
|
||||
list_display_links: Any = ...
|
||||
list_filter: Any = ...
|
||||
list_select_related: bool = ...
|
||||
list_display: Sequence[Union[str, Callable]] = ...
|
||||
list_display_links: Optional[Sequence[Union[str, Callable]]] = ...
|
||||
list_filter: Sequence[Union[str, Type[ListFilter], Tuple[str, Type[ListFilter]]]] = ...
|
||||
list_select_related: Union[bool, Sequence[str]] = ...
|
||||
list_per_page: int = ...
|
||||
list_max_show_all: int = ...
|
||||
list_editable: Any = ...
|
||||
search_fields: Any = ...
|
||||
date_hierarchy: Any = ...
|
||||
list_editable: Sequence[str] = ...
|
||||
search_fields: Sequence[str] = ...
|
||||
date_hierarchy: Optional[Any] = ...
|
||||
save_as: bool = ...
|
||||
save_as_continue: bool = ...
|
||||
save_on_top: bool = ...
|
||||
paginator: Any = ...
|
||||
preserve_filters: bool = ...
|
||||
inlines: Any = ...
|
||||
inlines: Sequence[Type[InlineModelAdmin]] = ...
|
||||
add_form_template: Any = ...
|
||||
change_form_template: Any = ...
|
||||
change_list_template: Any = ...
|
||||
@@ -126,64 +127,54 @@ class ModelAdmin(BaseModelAdmin):
|
||||
opts: Options = ...
|
||||
admin_site: AdminSite = ...
|
||||
def __init__(self, model: Type[Model], admin_site: Optional[AdminSite]) -> None: ...
|
||||
def get_inline_instances(self, request: WSGIRequest, obj: Optional[Model] = ...) -> List[InlineModelAdmin]: ...
|
||||
def get_inline_instances(self, request: HttpRequest, obj: Optional[Model] = ...) -> List[InlineModelAdmin]: ...
|
||||
def get_urls(self) -> List[URLPattern]: ...
|
||||
@property
|
||||
def urls(self) -> List[URLPattern]: ...
|
||||
@property
|
||||
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_changelist(self, request: WSGIRequest, **kwargs: Any) -> Type[ChangeList]: ...
|
||||
def get_changelist_instance(self, request: WSGIRequest) -> ChangeList: ...
|
||||
def get_object(self, request: WSGIRequest, object_id: str, from_field: None = ...) -> Optional[Model]: ...
|
||||
def get_changelist(self, request: HttpRequest, **kwargs: Any) -> Type[ChangeList]: ...
|
||||
def get_changelist_instance(self, request: HttpRequest) -> ChangeList: ...
|
||||
def get_object(self, request: HttpRequest, object_id: str, from_field: None = ...) -> Optional[Model]: ...
|
||||
def get_changelist_form(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[Model] = ...) -> Iterator[Any]: ...
|
||||
def get_paginator(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
request: HttpRequest,
|
||||
queryset: QuerySet,
|
||||
per_page: int,
|
||||
orphans: int = ...,
|
||||
allow_empty_first_page: bool = ...,
|
||||
) -> Paginator: ...
|
||||
def log_addition(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
object: Model,
|
||||
message: Union[Dict[str, Dict[Any, Any]], List[Dict[str, Dict[str, str]]]],
|
||||
) -> 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 log_addition(self, request: HttpRequest, object: Model, message: Any) -> LogEntry: ...
|
||||
def log_change(self, request: HttpRequest, object: Model, message: Any) -> LogEntry: ...
|
||||
def log_deletion(self, request: HttpRequest, object: Model, object_repr: str) -> LogEntry: ...
|
||||
def action_checkbox(self, obj: Model) -> SafeText: ...
|
||||
def get_actions(self, request: WSGIRequest) -> OrderedDict: ...
|
||||
def get_actions(self, request: HttpRequest) -> OrderedDict: ...
|
||||
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]]: ...
|
||||
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_links(
|
||||
self, request: WSGIRequest, list_display: Union[List[Callable], List[str], Tuple[str]]
|
||||
) -> Optional[Union[List[Callable], List[str], Tuple[str]]]: ...
|
||||
def get_list_filter(self, request: WSGIRequest) -> Union[List[Type[SimpleListFilter]], List[str], Tuple]: ...
|
||||
def get_list_select_related(self, request: WSGIRequest) -> Union[Tuple, bool]: ...
|
||||
def get_search_fields(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
|
||||
def get_list_display(self, request: HttpRequest) -> Sequence[str]: ...
|
||||
def get_list_display_links(self, request: HttpRequest, list_display: Sequence[str]) -> Optional[Sequence[str]]: ...
|
||||
def get_list_filter(self, request: HttpRequest) -> Sequence[str]: ...
|
||||
def get_list_select_related(self, request: HttpRequest) -> Sequence[str]: ...
|
||||
def get_search_fields(self, request: HttpRequest) -> List[str]: ...
|
||||
def get_search_results(
|
||||
self, request: WSGIRequest, queryset: QuerySet, search_term: str
|
||||
self, request: HttpRequest, queryset: QuerySet, search_term: str
|
||||
) -> 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(
|
||||
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]]]]: ...
|
||||
def message_user(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
request: HttpRequest,
|
||||
message: str,
|
||||
level: Union[int, str] = ...,
|
||||
extra_tags: str = ...,
|
||||
@@ -191,8 +182,8 @@ class ModelAdmin(BaseModelAdmin):
|
||||
) -> None: ...
|
||||
def save_form(self, request: Any, form: Any, change: Any): ...
|
||||
def save_model(self, request: Any, obj: Any, form: Any, change: Any) -> None: ...
|
||||
def delete_model(self, request: WSGIRequest, obj: Model) -> None: ...
|
||||
def delete_queryset(self, request: WSGIRequest, queryset: QuerySet) -> None: ...
|
||||
def delete_model(self, request: HttpRequest, obj: Model) -> 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_related(self, request: Any, form: Any, formsets: Any, change: Any) -> None: ...
|
||||
def render_change_form(
|
||||
@@ -204,51 +195,52 @@ class ModelAdmin(BaseModelAdmin):
|
||||
form_url: str = ...,
|
||||
obj: Optional[Any] = ...,
|
||||
): ...
|
||||
def response_add(self, request: WSGIRequest, obj: Model, post_url_continue: None = ...) -> HttpResponse: ...
|
||||
def response_change(self, request: WSGIRequest, obj: Model) -> HttpResponse: ...
|
||||
def response_post_save_add(self, request: WSGIRequest, obj: Model) -> HttpResponseRedirect: ...
|
||||
def response_post_save_change(self, request: WSGIRequest, obj: Model) -> HttpResponseRedirect: ...
|
||||
def response_action(self, request: WSGIRequest, queryset: QuerySet) -> Optional[HttpResponseBase]: ...
|
||||
def response_delete(self, request: WSGIRequest, obj_display: str, obj_id: int) -> HttpResponse: ...
|
||||
def response_add(
|
||||
self, request: HttpRequest, obj: Model, post_url_continue: Optional[str] = ...
|
||||
) -> HttpResponse: ...
|
||||
def response_change(self, request: HttpRequest, obj: Model) -> HttpResponse: ...
|
||||
def response_post_save_add(self, request: HttpRequest, obj: Model) -> HttpResponseRedirect: ...
|
||||
def response_post_save_change(self, request: HttpRequest, obj: Model) -> 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 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[Model] = ...
|
||||
) -> 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(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
request: HttpRequest,
|
||||
object_id: Optional[str] = ...,
|
||||
form_url: str = ...,
|
||||
extra_context: Optional[Dict[str, bool]] = ...,
|
||||
) -> Any: ...
|
||||
def autocomplete_view(self, request: WSGIRequest) -> JsonResponse: ...
|
||||
def add_view(self, request: WSGIRequest, form_url: str = ..., extra_context: None = ...) -> HttpResponse: ...
|
||||
def autocomplete_view(self, request: HttpRequest) -> JsonResponse: ...
|
||||
def add_view(self, request: HttpRequest, form_url: str = ..., extra_context: None = ...) -> HttpResponse: ...
|
||||
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: ...
|
||||
def changelist_view(
|
||||
self, request: WSGIRequest, extra_context: Optional[Dict[str, str]] = ...
|
||||
) -> HttpResponseBase: ...
|
||||
self, request: HttpRequest, extra_context: Optional[Dict[str, str]] = ...
|
||||
) -> TemplateResponse: ...
|
||||
def get_deleted_objects(
|
||||
self, objs: QuerySet, request: WSGIRequest
|
||||
self, objs: QuerySet, request: HttpRequest
|
||||
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
||||
def delete_view(self, request: WSGIRequest, object_id: str, extra_context: None = ...) -> Any: ...
|
||||
def history_view(self, request: WSGIRequest, object_id: str, extra_context: None = ...) -> HttpResponse: ...
|
||||
def delete_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> Any: ...
|
||||
def history_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> HttpResponse: ...
|
||||
|
||||
class InlineModelAdmin(BaseModelAdmin):
|
||||
model: Any = ...
|
||||
fk_name: Any = ...
|
||||
formset: Any = ...
|
||||
extra: int = ...
|
||||
min_num: Any = ...
|
||||
max_num: Any = ...
|
||||
template: Any = ...
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
min_num: Optional[int] = ...
|
||||
max_num: Optional[int] = ...
|
||||
template: str = ...
|
||||
verbose_name: Optional[str] = ...
|
||||
verbose_name_plural: Optional[str] = ...
|
||||
can_delete: bool = ...
|
||||
show_change_link: bool = ...
|
||||
checks_class: Any = ...
|
||||
classes: Any = ...
|
||||
admin_site: Any = ...
|
||||
parent_model: Any = ...
|
||||
@@ -257,18 +249,10 @@ class InlineModelAdmin(BaseModelAdmin):
|
||||
def __init__(self, parent_model: Union[Type[Model], Model], admin_site: AdminSite) -> None: ...
|
||||
@property
|
||||
def media(self) -> Media: ...
|
||||
def get_extra(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> int: ...
|
||||
def get_min_num(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> None: ...
|
||||
def get_max_num(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> Optional[int]: ...
|
||||
fields: Any = ...
|
||||
def get_extra(self, request: HttpRequest, obj: Optional[Model] = ..., **kwargs: Any) -> int: ...
|
||||
def get_min_num(self, request: HttpRequest, obj: Optional[Model] = ..., **kwargs: Any) -> Optional[int]: ...
|
||||
def get_max_num(self, request: HttpRequest, obj: Optional[Model] = ..., **kwargs: Any) -> Optional[int]: ...
|
||||
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):
|
||||
template: str = ...
|
||||
|
||||
class TabularInline(InlineModelAdmin):
|
||||
template: str = ...
|
||||
class StackedInline(InlineModelAdmin): ...
|
||||
class TabularInline(InlineModelAdmin): ...
|
||||
|
||||
@@ -26,8 +26,9 @@ class AdminSite:
|
||||
password_change_template: Any = ...
|
||||
password_change_done_template: Any = ...
|
||||
name: str = ...
|
||||
_registry: Dict[Type[Model], ModelAdmin]
|
||||
def __init__(self, name: str = ...) -> None: ...
|
||||
def check(self, app_configs: None) -> List[str]: ...
|
||||
def check(self, app_configs: None) -> List[Any]: ...
|
||||
def register(
|
||||
self,
|
||||
model_or_iterable: Union[List[Type[Model]], Tuple[Type[Model]], Type[Model]],
|
||||
@@ -47,9 +48,9 @@ class AdminSite:
|
||||
def empty_value_display(self, empty_value_display: Any) -> None: ...
|
||||
def has_permission(self, request: WSGIRequest) -> bool: ...
|
||||
def admin_view(self, view: Callable, cacheable: bool = ...) -> Callable: ...
|
||||
def get_urls(self) -> List[Union[URLPattern, URLResolver]]: ...
|
||||
def get_urls(self) -> List[URLResolver]: ...
|
||||
@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 password_change(self, request: WSGIRequest, extra_context: Dict[str, str] = ...) -> TemplateResponse: ...
|
||||
def password_change_done(self, request: WSGIRequest, extra_context: None = ...) -> TemplateResponse: ...
|
||||
|
||||
@@ -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.templatetags.base import InclusionAdminNode
|
||||
@@ -15,7 +15,7 @@ register: Any
|
||||
DOT: str
|
||||
|
||||
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 result_headers(cl: ChangeList) -> Iterator[Dict[str, Optional[Union[int, str]]]]: ...
|
||||
def items_for_result(cl: ChangeList, result: Model, form: None) -> Iterator[SafeText]: ...
|
||||
@@ -32,7 +32,7 @@ def result_list(
|
||||
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 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 search_form(cl: ChangeList) -> Dict[str, Union[bool, ChangeList, str]]: ...
|
||||
def search_form_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||
|
||||
@@ -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.context import Context
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import collections
|
||||
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 django.contrib.admin.options import BaseModelAdmin
|
||||
@@ -8,28 +9,23 @@ from django.contrib.auth.forms import AdminPasswordChangeForm
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.deletion import Collector
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.fields.mixins import FieldCacheMixin
|
||||
from django.db.models.fields.reverse_related import ForeignObjectRel, ManyToOneRel, OneToOneRel
|
||||
from django.db.models.fields.reverse_related import ManyToOneRel
|
||||
from django.db.models.options import Options
|
||||
from django.db.models.query import QuerySet
|
||||
from django.forms.forms import BaseForm
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from django.db.models.fields import Field, reverse_related
|
||||
|
||||
class FieldIsAForeignKeyColumnName(Exception): ...
|
||||
|
||||
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 quote(s: Union[int, str, UUID]) -> Union[int, str, UUID]: ...
|
||||
def quote(s: Union[int, str, UUID]) -> str: ...
|
||||
def unquote(s: str) -> str: ...
|
||||
def flatten(
|
||||
fields: Union[List[Union[Callable, str]], List[Union[List[str], str]], List[Union[Tuple[str, str], str]], Tuple]
|
||||
) -> 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 flatten(fields: Any) -> List[Union[Callable, str]]: ...
|
||||
def flatten_fieldsets(fieldsets: Any) -> List[Union[Callable, str]]: ...
|
||||
def get_deleted_objects(
|
||||
objs: QuerySet, request: WSGIRequest, admin_site: AdminSite
|
||||
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
||||
@@ -47,7 +43,7 @@ class NestedObjects(Collector):
|
||||
def add_edge(self, source: Optional[Model], target: Model) -> None: ...
|
||||
def collect(
|
||||
self,
|
||||
objs: Union[List[Model], QuerySet],
|
||||
objs: Union[Sequence[Optional[Model]], QuerySet],
|
||||
source: Optional[Type[Model]] = ...,
|
||||
source_attr: Optional[str] = ...,
|
||||
**kwargs: Any
|
||||
@@ -62,7 +58,11 @@ def lookup_field(
|
||||
name: Union[Callable, str], obj: Model, model_admin: BaseModelAdmin = ...
|
||||
) -> Tuple[Optional[Field], Callable, Callable]: ...
|
||||
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]: ...
|
||||
def help_text_for_field(name: str, model: Type[Model]) -> str: ...
|
||||
def display_for_field(
|
||||
|
||||
@@ -9,6 +9,7 @@ from django.db.models.expressions import Combinable, CombinedExpression, OrderBy
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
from django.db.models.options import Options
|
||||
from django.forms.formsets import BaseFormSet
|
||||
|
||||
ALL_VAR: str
|
||||
ORDER_VAR: str
|
||||
@@ -44,6 +45,7 @@ class ChangeList:
|
||||
queryset: Any = ...
|
||||
title: Any = ...
|
||||
pk_attname: Any = ...
|
||||
formset: Optional[BaseFormSet]
|
||||
def __init__(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
|
||||
@@ -3,12 +3,14 @@ from datetime import datetime
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
|
||||
from uuid import UUID
|
||||
|
||||
from django.forms.models import ModelChoiceIterator
|
||||
|
||||
from django import forms
|
||||
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, ManyToManyRel
|
||||
from django.db.models.query_utils import Q
|
||||
from django.forms.fields import Field
|
||||
from django.forms.widgets import ChoiceWidget, Media, Widget
|
||||
from django.forms.widgets import ChoiceWidget, Media, Widget, DateTimeBaseInput
|
||||
from django.http.request import QueryDict
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
|
||||
@@ -92,7 +94,7 @@ def url_params_from_lookup_dict(
|
||||
class ForeignKeyRawIdWidget(forms.TextInput):
|
||||
attrs: Dict[Any, Any]
|
||||
template_name: str = ...
|
||||
rel: django.db.models.fields.reverse_related.ManyToOneRel = ...
|
||||
rel: ManyToOneRel = ...
|
||||
admin_site: AdminSite = ...
|
||||
db: None = ...
|
||||
def __init__(self, rel: ForeignObjectRel, admin_site: AdminSite, attrs: None = ..., using: None = ...) -> None: ...
|
||||
@@ -107,7 +109,7 @@ class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
|
||||
admin_site: AdminSite
|
||||
attrs: Dict[Any, Any]
|
||||
db: None
|
||||
rel: django.db.models.fields.reverse_related.ManyToManyRel
|
||||
rel: ManyToManyRel
|
||||
template_name: str = ...
|
||||
def get_context(
|
||||
self, name: str, value: Optional[List[int]], attrs: Optional[Dict[str, str]]
|
||||
@@ -122,8 +124,8 @@ class RelatedFieldWidgetWrapper(forms.Widget):
|
||||
needs_multipart_form: bool = ...
|
||||
attrs: Dict[Any, Any] = ...
|
||||
choices: ModelChoiceIterator = ...
|
||||
widget: django.contrib.admin.widgets.AutocompleteSelect = ...
|
||||
rel: django.db.models.fields.reverse_related.ManyToOneRel = ...
|
||||
widget: AutocompleteSelect = ...
|
||||
rel: ManyToOneRel = ...
|
||||
can_add_related: bool = ...
|
||||
can_change_related: bool = ...
|
||||
can_delete_related: bool = ...
|
||||
|
||||
@@ -8,7 +8,11 @@ from django.db.models.base import Model
|
||||
from django.db.models.options import Options
|
||||
from django.http.request import HttpRequest
|
||||
|
||||
from .signals import user_logged_in, user_logged_out, user_login_failed
|
||||
from .signals import (
|
||||
user_logged_in as user_logged_in,
|
||||
user_logged_out as user_logged_out,
|
||||
user_login_failed as user_login_failed,
|
||||
)
|
||||
|
||||
SESSION_KEY: str
|
||||
BACKEND_SESSION_KEY: str
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.contrib.auth.models import User, Group
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.fields.related import ManyToManyField
|
||||
from django.db.models.options import Options
|
||||
from django.forms.models import ModelMultipleChoiceField
|
||||
from django.forms.fields import Field as FormField
|
||||
from django.forms.widgets import Widget
|
||||
from django.http.response import HttpResponse
|
||||
from django.urls.resolvers import URLPattern
|
||||
|
||||
@@ -27,10 +31,7 @@ class GroupAdmin(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]]],
|
||||
]
|
||||
formfield_overrides: Dict[Type[Field], Dict[str, Type[Union[FormField, Widget]]]]
|
||||
model: Type[User]
|
||||
opts: Options
|
||||
add_form_template: str = ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional, Tuple, List
|
||||
from typing import Any, Optional, Tuple, List, overload
|
||||
|
||||
from django.db import models
|
||||
|
||||
@@ -11,10 +11,9 @@ class BaseUserManager(models.Manager):
|
||||
class AbstractBaseUser(models.Model):
|
||||
password: models.CharField = ...
|
||||
last_login: Optional[models.DateTimeField] = ...
|
||||
is_active: bool = ...
|
||||
is_active: models.BooleanField = ...
|
||||
REQUIRED_FIELDS: List[str] = ...
|
||||
class Meta:
|
||||
abstract: bool = ...
|
||||
class Meta: ...
|
||||
def get_username(self) -> str: ...
|
||||
def clean(self) -> None: ...
|
||||
def save(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
@@ -31,4 +30,8 @@ class AbstractBaseUser(models.Model):
|
||||
@classmethod
|
||||
def get_email_field_name(cls) -> str: ...
|
||||
@classmethod
|
||||
@overload
|
||||
def normalize_username(cls, username: str) -> str: ...
|
||||
@classmethod
|
||||
@overload
|
||||
def normalize_username(cls, username: Any) -> Any: ...
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from typing import Any, Callable, List, Optional, Set, Union
|
||||
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME as REDIRECT_FIELD_NAME
|
||||
|
||||
def user_passes_test(
|
||||
test_func: Callable, login_url: Optional[str] = ..., redirect_field_name: str = ...
|
||||
) -> Callable: ...
|
||||
|
||||
@@ -42,13 +42,8 @@ class UserCreationForm(forms.ModelForm):
|
||||
error_messages: Any = ...
|
||||
password1: Any = ...
|
||||
password2: Any = ...
|
||||
class Meta:
|
||||
model: Any = ...
|
||||
fields: Any = ...
|
||||
field_classes: Any = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def clean_password2(self) -> str: ...
|
||||
def save(self, commit: bool = ...) -> User: ...
|
||||
|
||||
class UserChangeForm(forms.ModelForm):
|
||||
auto_id: str
|
||||
@@ -62,10 +57,6 @@ class UserChangeForm(forms.ModelForm):
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
password: Any = ...
|
||||
class Meta:
|
||||
model: Any = ...
|
||||
fields: str = ...
|
||||
field_classes: Any = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def clean_password(self) -> str: ...
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, List, Optional
|
||||
|
||||
UNUSABLE_PASSWORD_PREFIX: str
|
||||
@@ -17,92 +16,30 @@ def identify_hasher(encoded: str) -> BasePasswordHasher: ...
|
||||
def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ...
|
||||
|
||||
class BasePasswordHasher:
|
||||
algorithm: Any = ...
|
||||
library: Any = ...
|
||||
algorithm: str = ...
|
||||
library: str = ...
|
||||
rounds: int = ...
|
||||
time_cost: int = ...
|
||||
memory_cost: int = ...
|
||||
parallelism: int = ...
|
||||
digest: Any = ...
|
||||
iterations: Optional[int] = ...
|
||||
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 safe_summary(self, encoded: str) -> Any: ...
|
||||
def must_update(self, encoded: str) -> bool: ...
|
||||
def harden_runtime(self, password: str, encoded: str) -> None: ...
|
||||
|
||||
class PBKDF2PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
iterations: int = ...
|
||||
digest: Any = ...
|
||||
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):
|
||||
algorithm: str = ...
|
||||
digest: Any = ...
|
||||
|
||||
class Argon2PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
library: str = ...
|
||||
time_cost: int = ...
|
||||
memory_cost: int = ...
|
||||
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: ...
|
||||
class PBKDF2SHA1PasswordHasher(PBKDF2PasswordHasher): ...
|
||||
class Argon2PasswordHasher(BasePasswordHasher): ...
|
||||
class BCryptSHA256PasswordHasher(BasePasswordHasher): ...
|
||||
class BCryptPasswordHasher(BCryptSHA256PasswordHasher): ...
|
||||
class SHA1PasswordHasher(BasePasswordHasher): ...
|
||||
class MD5PasswordHasher(BasePasswordHasher): ...
|
||||
class UnsaltedSHA1PasswordHasher(BasePasswordHasher): ...
|
||||
class UnsaltedMD5PasswordHasher(BasePasswordHasher): ...
|
||||
class CryptPasswordHasher(BasePasswordHasher): ...
|
||||
|
||||
@@ -13,8 +13,8 @@ class AuthenticationMiddleware(MiddlewareMixin):
|
||||
class RemoteUserMiddleware(MiddlewareMixin):
|
||||
header: str = ...
|
||||
force_logout_if_no_header: bool = ...
|
||||
def process_request(self, request: WSGIRequest) -> None: ...
|
||||
def clean_username(self, username: str, request: WSGIRequest) -> str: ...
|
||||
def process_request(self, request: HttpRequest) -> None: ...
|
||||
def clean_username(self, username: str, request: HttpRequest) -> str: ...
|
||||
|
||||
class PersistentRemoteUserMiddleware(RemoteUserMiddleware):
|
||||
force_logout_if_no_header: bool = ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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
|
||||
|
||||
class AccessMixin:
|
||||
@@ -14,15 +14,15 @@ class AccessMixin:
|
||||
def handle_no_permission(self) -> HttpResponseRedirect: ...
|
||||
|
||||
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):
|
||||
permission_required: Any = ...
|
||||
def get_permission_required(self) -> List[str]: ...
|
||||
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):
|
||||
def test_func(self) -> None: ...
|
||||
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,46 +1,33 @@
|
||||
import datetime
|
||||
from typing import Any, List, Optional, Set, Tuple, Type, Union
|
||||
|
||||
from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser, BaseUserManager as BaseUserManager
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db.models.manager import EmptyManager
|
||||
|
||||
from django.contrib.auth.validators import UnicodeUsernameValidator
|
||||
from django.db import models
|
||||
|
||||
def update_last_login(sender: Type[AbstractBaseUser], user: AbstractBaseUser, **kwargs: Any) -> None: ...
|
||||
|
||||
class PermissionManager(models.Manager):
|
||||
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: ...
|
||||
|
||||
class Permission(models.Model):
|
||||
content_type_id: int
|
||||
id: int
|
||||
name: str = ...
|
||||
content_type: Any = ...
|
||||
codename: str = ...
|
||||
name: models.CharField = ...
|
||||
content_type: models.ForeignKey = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
||||
codename: models.CharField = ...
|
||||
def natural_key(self) -> Tuple[str, str, str]: ...
|
||||
|
||||
class GroupManager(models.Manager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
def get_by_natural_key(self, name: str) -> Group: ...
|
||||
|
||||
class Group(models.Model):
|
||||
id: None
|
||||
name: str = ...
|
||||
permissions: Any = ...
|
||||
name: models.CharField = ...
|
||||
permissions: models.ManyToManyField = models.ManyToManyField(Permission)
|
||||
def natural_key(self): ...
|
||||
|
||||
class UserManager(BaseUserManager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
def create_user(
|
||||
self, username: str, email: Optional[str] = ..., password: Optional[str] = ..., **extra_fields: Any
|
||||
) -> AbstractUser: ...
|
||||
@@ -49,24 +36,23 @@ class UserManager(BaseUserManager):
|
||||
) -> AbstractBaseUser: ...
|
||||
|
||||
class PermissionsMixin(models.Model):
|
||||
is_superuser: Any = ...
|
||||
groups: Any = ...
|
||||
user_permissions: Any = ...
|
||||
is_superuser: models.BooleanField = ...
|
||||
groups: models.ManyToManyField = models.ManyToManyField(Group)
|
||||
user_permissions: models.ManyToManyField = models.ManyToManyField(Permission)
|
||||
def get_group_permissions(self, obj: None = ...) -> Set[str]: ...
|
||||
def get_all_permissions(self, obj: Optional[str] = ...) -> Set[str]: ...
|
||||
def has_perm(self, perm: Union[Tuple[str, Any], str], obj: Optional[str] = ...) -> bool: ...
|
||||
def has_perms(self, perm_list: Union[List[str], Set[str], Tuple[str]], obj: None = ...) -> bool: ...
|
||||
def has_module_perms(self, app_label: str) -> bool: ...
|
||||
|
||||
class AbstractUser(AbstractBaseUser, PermissionsMixin):
|
||||
is_superuser: bool
|
||||
username_validator: Any = ...
|
||||
username: str = ...
|
||||
first_name: str = ...
|
||||
last_name: str = ...
|
||||
email: str = ...
|
||||
is_staff: bool = ...
|
||||
date_joined: datetime.datetime = ...
|
||||
class AbstractUser(AbstractBaseUser, PermissionsMixin): # type: ignore
|
||||
username_validator: UnicodeUsernameValidator = ...
|
||||
username: models.CharField = ...
|
||||
first_name: models.CharField = ...
|
||||
last_name: models.CharField = ...
|
||||
email: models.EmailField = ...
|
||||
is_staff: models.BooleanField = ...
|
||||
date_joined: models.DateTimeField = ...
|
||||
EMAIL_FIELD: str = ...
|
||||
USERNAME_FIELD: str = ...
|
||||
def clean(self) -> None: ...
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
from pathlib import PosixPath
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from pathlib import Path, PosixPath
|
||||
from typing import Any, List, Mapping, Optional, Protocol, Sequence, Set, Union
|
||||
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
def get_default_password_validators() -> Union[
|
||||
List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]
|
||||
]: ...
|
||||
def get_password_validators(
|
||||
validator_config: List[Dict[str, Union[Dict[str, int], str]]]
|
||||
) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
||||
class PasswordValidator(Protocol):
|
||||
def validate(self, password: str, user: Optional[AbstractBaseUser] = ...): ...
|
||||
|
||||
def get_default_password_validators() -> List[PasswordValidator]: ...
|
||||
def get_password_validators(validator_config: Sequence[Mapping[str, Any]]) -> List[PasswordValidator]: ...
|
||||
def validate_password(
|
||||
password: str, user: Optional[AbstractBaseUser] = ..., password_validators: Optional[List[Any]] = ...
|
||||
password: str,
|
||||
user: Optional[AbstractBaseUser] = ...,
|
||||
password_validators: Optional[Sequence[PasswordValidator]] = ...,
|
||||
) -> None: ...
|
||||
def password_changed(
|
||||
password: str, user: Optional[AbstractBaseUser] = ..., password_validators: None = ...
|
||||
password: str,
|
||||
user: Optional[AbstractBaseUser] = ...,
|
||||
password_validators: Optional[Sequence[PasswordValidator]] = ...,
|
||||
) -> 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
|
||||
|
||||
class MinimumLengthValidator:
|
||||
min_length: int = ...
|
||||
def __init__(self, min_length: int = ...) -> None: ...
|
||||
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
|
||||
def validate(self, password: str, user: Optional[AbstractBaseUser] = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
class UserAttributeSimilarityValidator:
|
||||
DEFAULT_USER_ATTRIBUTES: Any = ...
|
||||
user_attributes: Tuple[str, str, str, str] = ...
|
||||
DEFAULT_USER_ATTRIBUTES: Sequence[str] = ...
|
||||
user_attributes: Sequence[str] = ...
|
||||
max_similarity: float = ...
|
||||
def __init__(
|
||||
self, user_attributes: Union[List[str], Tuple[str, str, str, str]] = ..., max_similarity: float = ...
|
||||
) -> None: ...
|
||||
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
|
||||
def __init__(self, user_attributes: Sequence[str] = ..., max_similarity: float = ...) -> None: ...
|
||||
def validate(self, password: str, user: Optional[AbstractBaseUser] = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
class CommonPasswordValidator:
|
||||
DEFAULT_PASSWORD_LIST_PATH: Any = ...
|
||||
DEFAULT_PASSWORD_LIST_PATH: Path = ...
|
||||
passwords: Set[str] = ...
|
||||
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[AbstractBaseUser] = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
class NumericPasswordValidator:
|
||||
|
||||
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): ...
|
||||
@@ -32,9 +32,7 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView):
|
||||
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]]: ...
|
||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
||||
|
||||
class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
|
||||
next_page: Any = ...
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
from django.db.models.base import Model
|
||||
from typing import Any, List, Type
|
||||
|
||||
from django.contrib.admin.options import InlineModelAdmin
|
||||
from django.db.models.base import Model
|
||||
|
||||
class GenericInlineModelAdminChecks:
|
||||
def _check_exclude_of_parent_model(self, obj: GenericTabularInline, parent_model: Type[Model]) -> List[Any]: ...
|
||||
def _check_relation(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: GenericInlineModelAdmin, parent_model: Type[Model]) -> List[Any]: ...
|
||||
|
||||
class GenericInlineModelAdmin(InlineModelAdmin):
|
||||
template: str = ...
|
||||
|
||||
class GenericStackedInline(GenericInlineModelAdmin): ...
|
||||
class GenericTabularInline(GenericInlineModelAdmin): ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, Generic
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.checks.messages import Error
|
||||
@@ -51,7 +51,7 @@ class GenericForeignKey(FieldCacheMixin):
|
||||
|
||||
class GenericRel(ForeignObjectRel):
|
||||
field: GenericRelation
|
||||
limit_choices_to: Dict[Any, Any]
|
||||
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]]
|
||||
model: Type[Model]
|
||||
multiple: bool
|
||||
on_delete: Callable
|
||||
@@ -65,7 +65,7 @@ class GenericRel(ForeignObjectRel):
|
||||
to: Union[Type[Model], str],
|
||||
related_name: None = ...,
|
||||
related_query_name: Optional[str] = ...,
|
||||
limit_choices_to: None = ...,
|
||||
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class GenericRelation(ForeignObject):
|
||||
@@ -79,6 +79,7 @@ class GenericRelation(ForeignObject):
|
||||
object_id_field_name: Any = ...
|
||||
content_type_field_name: Any = ...
|
||||
for_concrete_model: Any = ...
|
||||
to_fields: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
to: Union[Type[Model], str],
|
||||
@@ -86,17 +87,15 @@ class GenericRelation(ForeignObject):
|
||||
content_type_field: str = ...,
|
||||
for_concrete_model: bool = ...,
|
||||
related_query_name: Optional[str] = ...,
|
||||
limit_choices_to: None = ...,
|
||||
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ...,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||
to_fields: Any = ...
|
||||
def resolve_related_fields(self) -> List[Tuple[PositiveIntegerField, Field]]: ...
|
||||
def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> 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: ...
|
||||
|
||||
@@ -4,12 +4,7 @@ from django.db import models
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
class ContentTypeManager(models.Manager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
class ContentTypeManager(models.Manager["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_models(self, *models: Any, for_concrete_models: bool = ...) -> Dict[Type[Model], ContentType]: ...
|
||||
@@ -18,14 +13,9 @@ class ContentTypeManager(models.Manager):
|
||||
|
||||
class ContentType(models.Model):
|
||||
id: int
|
||||
app_label: str = ...
|
||||
model: str = ...
|
||||
objects: Any = ...
|
||||
class Meta:
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
db_table: str = ...
|
||||
unique_together: Any = ...
|
||||
app_label: models.CharField = ...
|
||||
model: models.CharField = ...
|
||||
objects: ContentTypeManager = ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
def model_class(self) -> Optional[Type[Model]]: ...
|
||||
|
||||
@@ -15,8 +15,5 @@ class FlatpageForm(forms.ModelForm):
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
url: Any = ...
|
||||
class Meta:
|
||||
model: Any = ...
|
||||
fields: 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
|
||||
|
||||
class FlatPage(models.Model):
|
||||
id: None
|
||||
url: str = ...
|
||||
title: str = ...
|
||||
content: str = ...
|
||||
enable_comments: bool = ...
|
||||
template_name: str = ...
|
||||
registration_required: bool = ...
|
||||
sites: Any = ...
|
||||
class Meta:
|
||||
db_table: str = ...
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
ordering: Any = ...
|
||||
url: models.CharField = ...
|
||||
title: models.CharField = ...
|
||||
content: models.TextField = ...
|
||||
enable_comments: models.BooleanField = ...
|
||||
template_name: models.CharField = ...
|
||||
registration_required: models.BooleanField = ...
|
||||
sites: models.ManyToManyField[Site] = ...
|
||||
def get_absolute_url(self) -> str: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from datetime import date, datetime
|
||||
from datetime import date, datetime as datetime
|
||||
from decimal import Decimal
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
from .api import (
|
||||
get_level as get_level,
|
||||
set_level as set_level,
|
||||
add_message as add_message,
|
||||
debug as debug,
|
||||
error as error,
|
||||
success as success,
|
||||
get_messages as get_messages,
|
||||
MessageFailure as MessageFailure,
|
||||
info as info,
|
||||
warning as warning,
|
||||
)
|
||||
|
||||
from .constants import (
|
||||
DEBUG as DEBUG,
|
||||
DEFAULT_LEVELS as DEFAULT_LEVELS,
|
||||
DEFAULT_TAGS as DEFAULT_TAGS,
|
||||
ERROR as ERROR,
|
||||
INFO as INFO,
|
||||
SUCCESS as SUCCESS,
|
||||
WARNING as WARNING,
|
||||
)
|
||||
|
||||
default_app_config: str = ...
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponseBase
|
||||
from django.http.response import HttpResponse
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
|
||||
class MessageMiddleware(MiddlewareMixin):
|
||||
def process_request(self, request: WSGIRequest) -> None: ...
|
||||
def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
||||
def process_request(self, request: HttpRequest) -> None: ...
|
||||
def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
|
||||
|
||||
@@ -8,3 +8,4 @@ from .ranges import (
|
||||
DateRangeField as DateRangeField,
|
||||
DateTimeRangeField as DateTimeRangeField,
|
||||
)
|
||||
from .hstore import HStoreField as HStoreField
|
||||
|
||||
@@ -1,34 +1,51 @@
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union, TypeVar, Generic, Sequence
|
||||
from typing import Any, Iterable, List, Optional, Sequence, TypeVar, Union
|
||||
|
||||
from django.db.models.expressions import Combinable
|
||||
from django.db.models.fields import Field, _ErrorMessagesToOverride, _FieldChoices, _ValidatorCallable
|
||||
|
||||
from django.db.models.fields import Field
|
||||
from .mixins import CheckFieldDefaultMixin
|
||||
|
||||
_T = TypeVar("_T", bound=Field)
|
||||
# __set__ value type
|
||||
_ST = TypeVar("_ST")
|
||||
# __get__ return type
|
||||
_GT = TypeVar("_GT")
|
||||
|
||||
class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]):
|
||||
_pyi_private_set_type: Union[Sequence[Any], Combinable]
|
||||
_pyi_private_get_type: List[Any]
|
||||
|
||||
class ArrayField(CheckFieldDefaultMixin, Field, Generic[_T]):
|
||||
empty_strings_allowed: bool = ...
|
||||
default_error_messages: Any = ...
|
||||
base_field: Any = ...
|
||||
size: Any = ...
|
||||
default_validators: Any = ...
|
||||
from_db_value: Any = ...
|
||||
def __init__(self, base_field: _T, size: None = ..., **kwargs: Any) -> None: ...
|
||||
@property
|
||||
def model(self): ...
|
||||
@model.setter
|
||||
def model(self, model: Any) -> None: ...
|
||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||
def set_attributes_from_name(self, name: str) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
base_field: Field,
|
||||
size: Optional[int] = ...,
|
||||
verbose_name: Optional[Union[str, bytes]] = ...,
|
||||
name: Optional[str] = ...,
|
||||
primary_key: bool = ...,
|
||||
max_length: Optional[int] = ...,
|
||||
unique: bool = ...,
|
||||
blank: bool = ...,
|
||||
null: bool = ...,
|
||||
db_index: bool = ...,
|
||||
default: Any = ...,
|
||||
editable: bool = ...,
|
||||
auto_created: bool = ...,
|
||||
serialize: bool = ...,
|
||||
unique_for_date: Optional[str] = ...,
|
||||
unique_for_month: Optional[str] = ...,
|
||||
unique_for_year: Optional[str] = ...,
|
||||
choices: Optional[_FieldChoices] = ...,
|
||||
help_text: str = ...,
|
||||
db_column: Optional[str] = ...,
|
||||
db_tablespace: Optional[str] = ...,
|
||||
validators: Iterable[_ValidatorCallable] = ...,
|
||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||
) -> None: ...
|
||||
@property
|
||||
def description(self): ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def get_db_prep_value(self, value: Any, connection: Any, prepared: bool = ...): ...
|
||||
def deconstruct(self) -> Tuple[None, str, List[Any], Dict[str, Optional[Union[bool, Field]]]]: ...
|
||||
def to_python(self, value: Any): ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def get_transform(self, name: Any): ...
|
||||
def validate(self, value: Any, model_instance: Any) -> None: ...
|
||||
def run_validators(self, value: Any) -> None: ...
|
||||
def formfield(self, **kwargs: Any): ...
|
||||
def __set__(self, instance, value: Sequence[_T]): ...
|
||||
def __get__(self, instance, owner) -> List[_T]: ...
|
||||
|
||||
17
django-stubs/contrib/postgres/fields/hstore.pyi
Normal file
17
django-stubs/contrib/postgres/fields/hstore.pyi
Normal file
@@ -0,0 +1,17 @@
|
||||
from typing import Any
|
||||
|
||||
from django.db.models import Field, Transform
|
||||
from .mixins import CheckFieldDefaultMixin
|
||||
|
||||
class HStoreField(CheckFieldDefaultMixin, Field):
|
||||
def get_transform(self, name) -> Any: ...
|
||||
|
||||
class KeyTransform(Transform):
|
||||
def __init__(self, key_name: str, *args: Any, **kwargs: Any): ...
|
||||
|
||||
class KeyTransformFactory:
|
||||
def __init__(self, key_name: str): ...
|
||||
def __call__(self, *args, **kwargs) -> KeyTransform: ...
|
||||
|
||||
class KeysTransform(Transform): ...
|
||||
class ValuesTransform(Transform): ...
|
||||
@@ -2,46 +2,27 @@ from typing import Any
|
||||
|
||||
from django.db import models
|
||||
|
||||
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange # type: ignore
|
||||
|
||||
class RangeField(models.Field):
|
||||
empty_strings_allowed: bool = ...
|
||||
base_field: Any = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
@property
|
||||
def model(self): ...
|
||||
@model.setter
|
||||
def model(self, model: Any) -> None: ...
|
||||
range_type: Any = ...
|
||||
def get_prep_value(self, value: Any): ...
|
||||
def to_python(self, value: Any): ...
|
||||
def set_attributes_from_name(self, name: str) -> None: ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def formfield(self, **kwargs: Any): ...
|
||||
|
||||
class IntegerRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def __get__(self, instance, owner) -> NumericRange: ...
|
||||
|
||||
class BigIntegerRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def __get__(self, instance, owner) -> NumericRange: ...
|
||||
|
||||
class FloatRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def __get__(self, instance, owner) -> NumericRange: ...
|
||||
|
||||
class DateTimeRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def __get__(self, instance, owner) -> DateTimeTZRange: ...
|
||||
|
||||
class DateRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def __get__(self, instance, owner) -> DateRange: ...
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from typing import Any
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
|
||||
class RedirectFallbackMiddleware(MiddlewareMixin):
|
||||
response_gone_class: Any = ...
|
||||
response_redirect_class: Any = ...
|
||||
def process_response(self, request: WSGIRequest, response: HttpResponse) -> HttpResponse: ...
|
||||
def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.db import models
|
||||
|
||||
class Redirect(models.Model):
|
||||
id: None
|
||||
site_id: int
|
||||
site: Any = ...
|
||||
old_path: str = ...
|
||||
new_path: str = ...
|
||||
class Meta:
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
db_table: str = ...
|
||||
unique_together: Any = ...
|
||||
ordering: Any = ...
|
||||
site: models.ForeignKey = ...
|
||||
old_path: models.CharField = ...
|
||||
new_path: models.CharField = ...
|
||||
|
||||
@@ -8,26 +8,18 @@ VALID_KEY_CHARS: Any
|
||||
class CreateError(Exception): ...
|
||||
class UpdateError(Exception): ...
|
||||
|
||||
class SessionBase:
|
||||
class SessionBase(Dict[str, Any]):
|
||||
TEST_COOKIE_NAME: str = ...
|
||||
TEST_COOKIE_VALUE: str = ...
|
||||
accessed: bool = ...
|
||||
modified: bool = ...
|
||||
serializer: Any = ...
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __getitem__(self, key: str) -> Any: ...
|
||||
def __setitem__(self, key: str, value: Any) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def get(self, key: str, default: Optional[str] = ...) -> Any: ...
|
||||
def pop(self, key: str, default: Any = ...) -> Any: ...
|
||||
def setdefault(self, key: str, value: str) -> str: ...
|
||||
def set_test_cookie(self) -> None: ...
|
||||
def test_cookie_worked(self) -> bool: ...
|
||||
def delete_test_cookie(self) -> None: ...
|
||||
def encode(self, session_dict: Dict[str, Model]) -> str: ...
|
||||
def decode(self, session_data: Union[bytes, str]) -> Dict[str, Model]: ...
|
||||
def update(self, dict_: Dict[str, int]) -> None: ...
|
||||
def has_key(self, key: Any): ...
|
||||
def keys(self): ...
|
||||
def values(self): ...
|
||||
@@ -41,10 +33,10 @@ class SessionBase:
|
||||
def get_expire_at_browser_close(self) -> bool: ...
|
||||
def flush(self) -> None: ...
|
||||
def cycle_key(self) -> None: ...
|
||||
def exists(self, session_key: Any) -> None: ...
|
||||
def exists(self, session_key: str) -> None: ...
|
||||
def create(self) -> None: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
def delete(self, session_key: Optional[Any] = ...) -> None: ...
|
||||
def load(self) -> None: ...
|
||||
def load(self) -> Dict[str, Any]: ...
|
||||
@classmethod
|
||||
def clear_expired(cls) -> None: ...
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
from typing import Any, Dict, Optional, Type, Union
|
||||
from typing import Dict, Optional, Type, Union
|
||||
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from django.contrib.sessions.base_session import AbstractBaseSession
|
||||
from django.contrib.sessions.models import Session
|
||||
from django.core.signing import Serializer
|
||||
from django.db.models.base import Model
|
||||
|
||||
class SessionStore(SessionBase):
|
||||
accessed: bool
|
||||
serializer: Type[django.core.signing.JSONSerializer]
|
||||
serializer: Type[Serializer]
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
@classmethod
|
||||
def get_model_class(cls) -> Type[Session]: ...
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict, Optional, Type
|
||||
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
|
||||
from django.db import models
|
||||
|
||||
class BaseSessionManager(models.Manager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
def encode(self, session_dict: Dict[str, int]) -> str: ...
|
||||
def save(self, session_key: str, session_dict: Dict[str, int], expire_date: datetime) -> AbstractBaseSession: ...
|
||||
|
||||
class AbstractBaseSession(models.Model):
|
||||
session_key: Any = ...
|
||||
session_data: Any = ...
|
||||
expire_date: Any = ...
|
||||
expire_date: datetime
|
||||
session_data: str
|
||||
session_key: str
|
||||
objects: Any = ...
|
||||
class Meta:
|
||||
abstract: bool = ...
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
@classmethod
|
||||
def get_session_store_class(cls) -> None: ...
|
||||
def get_session_store_class(cls) -> Optional[Type[SessionBase]]: ...
|
||||
def get_decoded(self) -> Dict[str, int]: ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from typing import Type
|
||||
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
@@ -9,4 +8,4 @@ from django.utils.deprecation import MiddlewareMixin
|
||||
class SessionMiddleware(MiddlewareMixin):
|
||||
SessionStore: Type[SessionBase] = ...
|
||||
def process_request(self, request: HttpRequest) -> None: ...
|
||||
def process_response(self, request: WSGIRequest, response: HttpResponse) -> HttpResponse: ...
|
||||
def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
from typing import Any, Optional, Type
|
||||
|
||||
from django.contrib.sessions.backends.db import SessionStore
|
||||
from django.contrib.sessions.base_session import AbstractBaseSession, BaseSessionManager
|
||||
|
||||
class SessionManager(BaseSessionManager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
|
||||
class Session(AbstractBaseSession):
|
||||
expire_date: datetime.datetime
|
||||
session_data: str
|
||||
session_key: str
|
||||
objects: Any = ...
|
||||
@classmethod
|
||||
def get_session_store_class(cls) -> Type[SessionStore]: ...
|
||||
class Meta(AbstractBaseSession.Meta):
|
||||
db_table: str = ...
|
||||
class SessionManager(BaseSessionManager): ...
|
||||
class Session(AbstractBaseSession): ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Dict
|
||||
|
||||
from django.core.signing import JSONSerializer as BaseJSONSerializer
|
||||
from django.db.models.base import Model
|
||||
|
||||
@@ -11,7 +11,7 @@ PING_URL: str
|
||||
|
||||
class SitemapNotFound(Exception): ...
|
||||
|
||||
def ping_google(sitemap_url: None = ..., ping_url: str = ...) -> None: ...
|
||||
def ping_google(sitemap_url: Optional[str] = ..., ping_url: str = ...) -> None: ...
|
||||
|
||||
class Sitemap:
|
||||
limit: int = ...
|
||||
@@ -22,14 +22,14 @@ class Sitemap:
|
||||
def paginator(self) -> Paginator: ...
|
||||
def get_urls(
|
||||
self, page: Union[int, str] = ..., site: Optional[Union[Site, RequestSite]] = ..., protocol: Optional[str] = ...
|
||||
) -> List[Dict[str, Optional[Union[datetime, Model, str]]]]: ...
|
||||
) -> List[Dict[str, Any]]: ...
|
||||
|
||||
class GenericSitemap(Sitemap):
|
||||
priority: None = ...
|
||||
changefreq: None = ...
|
||||
priority: Optional[float] = ...
|
||||
changefreq: Optional[str] = ...
|
||||
queryset: QuerySet = ...
|
||||
date_field: None = ...
|
||||
protocol: None = ...
|
||||
protocol: Optional[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
info_dict: Dict[str, Union[datetime, QuerySet, str]],
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, Optional, Type, Union
|
||||
from typing import Callable, Dict, Optional, Type, Union
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.response import TemplateResponse
|
||||
|
||||
from django.contrib.sitemaps import GenericSitemap, Sitemap
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.template.response import TemplateResponse
|
||||
|
||||
def x_robots_tag(func: Callable) -> Callable: ...
|
||||
def index(
|
||||
request: WSGIRequest,
|
||||
request: HttpRequest,
|
||||
sitemaps: Dict[str, Union[Type[Sitemap], Sitemap]],
|
||||
template_name: str = ...,
|
||||
content_type: str = ...,
|
||||
sitemap_url_name: str = ...,
|
||||
) -> TemplateResponse: ...
|
||||
def sitemap(
|
||||
request: WSGIRequest,
|
||||
request: HttpRequest,
|
||||
sitemaps: Union[Dict[str, Type[Sitemap]], Dict[str, GenericSitemap], OrderedDict],
|
||||
section: Optional[str] = ...,
|
||||
template_name: str = ...,
|
||||
|
||||
@@ -7,24 +7,14 @@ from django.db import models
|
||||
SITE_CACHE: Any
|
||||
|
||||
class SiteManager(models.Manager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
def get_current(self, request: Optional[HttpRequest] = ...) -> Site: ...
|
||||
def clear_cache(self) -> None: ...
|
||||
def get_by_natural_key(self, domain: str) -> Site: ...
|
||||
|
||||
class Site(models.Model):
|
||||
id: int
|
||||
domain: str = ...
|
||||
name: str = ...
|
||||
objects: Any = ...
|
||||
class Meta:
|
||||
db_table: str = ...
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
ordering: Any = ...
|
||||
domain: models.CharField = ...
|
||||
name: models.CharField = ...
|
||||
objects: SiteManager = ...
|
||||
def natural_key(self) -> Tuple[str]: ...
|
||||
|
||||
def clear_site_cache(sender: Type[Site], **kwargs: Any) -> None: ...
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from typing import Any, Iterator, List, Optional, Tuple, Union
|
||||
from typing import Any, Iterator, List, Optional, Tuple, Union, Mapping, overload
|
||||
|
||||
from django.contrib.staticfiles.storage import StaticFilesStorage
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.files.storage import DefaultStorage, FileSystemStorage
|
||||
from django.core.files.storage import DefaultStorage, FileSystemStorage, Storage
|
||||
from typing_extensions import Literal
|
||||
|
||||
searched_locations: Any
|
||||
|
||||
@@ -13,7 +14,7 @@ class BaseFinder:
|
||||
|
||||
class FileSystemFinder(BaseFinder):
|
||||
locations: List[Any] = ...
|
||||
storages: collections.OrderedDict = ...
|
||||
storages: Mapping[str, Any] = ...
|
||||
def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||
@@ -24,22 +25,27 @@ class AppDirectoriesFinder(BaseFinder):
|
||||
storage_class: Any = ...
|
||||
source_dir: str = ...
|
||||
apps: List[str] = ...
|
||||
storages: collections.OrderedDict = ...
|
||||
storages: Mapping[str, Any] = ...
|
||||
def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, FileSystemStorage]]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||
def find_in_app(self, app: str, path: str) -> Optional[str]: ...
|
||||
|
||||
class BaseStorageFinder(BaseFinder):
|
||||
storage: Any = ...
|
||||
def __init__(self, storage: Optional[StaticFilesStorage] = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||
storage: Storage = ...
|
||||
def __init__(self, storage: Optional[Storage] = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, DefaultStorage]]: ...
|
||||
|
||||
class DefaultStorageFinder(BaseStorageFinder):
|
||||
storage: django.contrib.staticfiles.storage.StaticFilesStorage = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
class DefaultStorageFinder(BaseStorageFinder): ...
|
||||
|
||||
def find(path: str, all: bool = ...) -> Optional[Union[List[str], str]]: ...
|
||||
def get_finders() -> Iterator[BaseFinder]: ...
|
||||
@overload
|
||||
def get_finder(import_path: Literal["django.contrib.staticfiles.finders.FileSystemFinder"]) -> FileSystemFinder: ...
|
||||
@overload
|
||||
def get_finder(
|
||||
import_path: Literal["django.contrib.staticfiles.finders.AppDirectoriesFinder"]
|
||||
) -> AppDirectoriesFinder: ...
|
||||
@overload
|
||||
def get_finder(import_path: str) -> BaseFinder: ...
|
||||
|
||||
@@ -23,5 +23,5 @@ class Feed:
|
||||
def feed_extra_kwargs(self, obj: None) -> Dict[Any, Any]: ...
|
||||
def item_extra_kwargs(self, item: Model) -> Dict[Any, Any]: ...
|
||||
def get_object(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> None: ...
|
||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Model]: ...
|
||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
||||
def get_feed(self, obj: None, request: WSGIRequest) -> SyndicationFeed: ...
|
||||
|
||||
2
django-stubs/core/cache/__init__.pyi
vendored
2
django-stubs/core/cache/__init__.pyi
vendored
@@ -1,7 +1,7 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache as BaseCache
|
||||
from .backends.base import BaseCache as BaseCache
|
||||
|
||||
DEFAULT_CACHE_ALIAS: str
|
||||
|
||||
|
||||
2
django-stubs/core/cache/backends/base.pyi
vendored
2
django-stubs/core/cache/backends/base.pyi
vendored
@@ -21,7 +21,7 @@ class BaseCache:
|
||||
def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ...
|
||||
def make_key(self, key: Union[int, str], version: Optional[Union[int, str]] = ...) -> str: ...
|
||||
def add(self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...) -> None: ...
|
||||
def get(self, key: Any, default: Optional[Any] = ..., version: Optional[Any] = ...) -> None: ...
|
||||
def get(self, key: Any, default: Optional[Any] = ..., version: Optional[Any] = ...) -> Any: ...
|
||||
def set(self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...) -> None: ...
|
||||
def touch(self, key: Any, timeout: Any = ..., version: Optional[Any] = ...) -> None: ...
|
||||
def delete(self, key: Any, version: Optional[Any] = ...) -> None: ...
|
||||
|
||||
4
django-stubs/core/cache/utils.pyi
vendored
4
django-stubs/core/cache/utils.pyi
vendored
@@ -1,5 +1,5 @@
|
||||
from typing import Any, List, Optional, Union
|
||||
from typing import Any, Iterable, Optional
|
||||
|
||||
TEMPLATE_FRAGMENT_KEY_TEMPLATE: str
|
||||
|
||||
def make_template_fragment_key(fragment_name: str, vary_on: Optional[Union[List[int], List[str]]] = ...) -> str: ...
|
||||
def make_template_fragment_key(fragment_name: str, vary_on: Optional[Iterable[Any]] = ...) -> str: ...
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
from .messages import Warning as Warning, Info as Info, Debug as Debug, Error as Error, Critical as Critical
|
||||
|
||||
from .registry import run_checks as run_checks, Tags as Tags, register as register
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Any, Optional
|
||||
|
||||
DEBUG: int
|
||||
INFO: int
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
from django.core.checks.messages import Warning
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
from typing import Any, Dict, Iterator, List, Mapping, Optional, Tuple, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
from django.forms.utils import ErrorDict
|
||||
|
||||
class FieldDoesNotExist(Exception): ...
|
||||
@@ -31,20 +30,13 @@ class ValidationError(Exception):
|
||||
message: Any = ...
|
||||
code: Any = ...
|
||||
params: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
message: Any,
|
||||
code: Optional[str] = ...,
|
||||
params: Optional[
|
||||
Union[Dict[str, Union[Tuple[str], Type[Model], Model, str]], Dict[str, Union[int, str]]]
|
||||
] = ...,
|
||||
) -> None: ...
|
||||
def __init__(self, message: Any, code: Optional[str] = ..., params: Optional[Mapping[str, Any]] = ...) -> None: ...
|
||||
@property
|
||||
def message_dict(self) -> Dict[str, List[str]]: ...
|
||||
@property
|
||||
def messages(self) -> List[str]: ...
|
||||
def update_error_dict(
|
||||
self, error_dict: Union[Dict[str, List[ValidationError]], ErrorDict]
|
||||
self, error_dict: Mapping[str, Any]
|
||||
) -> Union[Dict[str, List[ValidationError]], ErrorDict]: ...
|
||||
def __iter__(self) -> Iterator[Union[Tuple[str, List[str]], str]]: ...
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
from datetime import datetime
|
||||
from io import StringIO, TextIOWrapper
|
||||
from typing import Any, List, Optional, Tuple, Union
|
||||
from typing import Any, IO, List, Optional, Tuple
|
||||
|
||||
from django.core.files.base import File
|
||||
from django.utils.functional import LazyObject
|
||||
|
||||
class Storage:
|
||||
def open(self, name: str, mode: str = ...) -> File: ...
|
||||
def save(
|
||||
self, name: Optional[str], content: Union[StringIO, TextIOWrapper, File], max_length: Optional[int] = ...
|
||||
) -> str: ...
|
||||
def save(self, name: Optional[str], content: IO[Any], max_length: Optional[int] = ...) -> str: ...
|
||||
def get_valid_name(self, name: str) -> str: ...
|
||||
def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ...
|
||||
def generate_filename(self, filename: str) -> str: ...
|
||||
@@ -31,10 +28,15 @@ class FileSystemStorage(Storage):
|
||||
file_permissions_mode: Optional[int] = ...,
|
||||
directory_permissions_mode: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
@property
|
||||
def base_location(self) -> str: ...
|
||||
@property
|
||||
def location(self) -> str: ...
|
||||
@property
|
||||
def base_url(self) -> str: ...
|
||||
@property
|
||||
def file_permissions_mode(self) -> Optional[int]: ...
|
||||
@property
|
||||
def directory_permissions_mode(self) -> Optional[int]: ...
|
||||
|
||||
class DefaultStorage(LazyObject): ...
|
||||
|
||||
@@ -1,45 +1,48 @@
|
||||
# Stubs for django.core.files.uploadedfile (Python 3.5)
|
||||
|
||||
from typing import Any, Dict, IO, Iterator, Optional, Union
|
||||
from django.core.files import temp as tempfile
|
||||
from django.core.files.base import File
|
||||
|
||||
class UploadedFile(File):
|
||||
content_type = ... # type: Optional[str]
|
||||
charset = ... # type: Optional[str]
|
||||
content_type_extra = ... # type: Optional[Dict[str, str]]
|
||||
content_type: Optional[str] = ...
|
||||
charset: Optional[str] = ...
|
||||
content_type_extra: Optional[Dict[str, str]] = ...
|
||||
def __init__(
|
||||
self,
|
||||
file: IO,
|
||||
name: str = None,
|
||||
content_type: str = None,
|
||||
size: int = None,
|
||||
charset: str = None,
|
||||
content_type_extra: Dict[str, str] = None,
|
||||
file: Optional[IO] = ...,
|
||||
name: Optional[str] = ...,
|
||||
content_type: Optional[str] = ...,
|
||||
size: Optional[int] = ...,
|
||||
charset: Optional[str] = ...,
|
||||
content_type_extra: Optional[Dict[str, str]] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class TemporaryUploadedFile(UploadedFile):
|
||||
def __init__(
|
||||
self, name: str, content_type: str, size: int, charset: str, content_type_extra: Dict[str, str] = None
|
||||
self,
|
||||
name: Optional[str],
|
||||
content_type: Optional[str],
|
||||
size: Optional[int],
|
||||
charset: Optional[str],
|
||||
content_type_extra: Optional[Dict[str, str]] = ...,
|
||||
) -> None: ...
|
||||
def temporary_file_path(self) -> str: ...
|
||||
|
||||
class InMemoryUploadedFile(UploadedFile):
|
||||
field_name = ... # type: Optional[str]
|
||||
field_name: Optional[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
file: IO,
|
||||
field_name: Optional[str],
|
||||
name: str,
|
||||
name: Optional[str],
|
||||
content_type: Optional[str],
|
||||
size: int,
|
||||
size: Optional[int],
|
||||
charset: Optional[str],
|
||||
content_type_extra: Dict[str, str] = None,
|
||||
content_type_extra: Dict[str, str] = ...,
|
||||
) -> None: ...
|
||||
def chunks(self, chunk_size: int = None) -> Iterator[bytes]: ...
|
||||
def multiple_chunks(self, chunk_size: int = None) -> bool: ...
|
||||
def chunks(self, chunk_size: Optional[int] = ...) -> Iterator[bytes]: ...
|
||||
def multiple_chunks(self, chunk_size: Optional[int] = ...) -> bool: ...
|
||||
|
||||
class SimpleUploadedFile(InMemoryUploadedFile):
|
||||
def __init__(self, name: str, content: bytes, content_type: str = "") -> None: ...
|
||||
def __init__(self, name: str, content: Optional[Union[bytes, str]], content_type: str = ...) -> None: ...
|
||||
@classmethod
|
||||
def from_dict(cls: Any, file_dict: Dict[str, Union[str, bytes]]) -> None: ...
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
from typing import Any, Callable
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse, HttpResponseBase
|
||||
|
||||
logger: Any
|
||||
|
||||
class BaseHandler:
|
||||
_view_middleware: None = ...
|
||||
_template_response_middleware: None = ...
|
||||
_exception_middleware: None = ...
|
||||
_middleware_chain: None = ...
|
||||
def load_middleware(self) -> None: ...
|
||||
def make_view_atomic(self, view: Callable) -> Callable: ...
|
||||
def get_exception_response(self, request: Any, resolver: Any, status_code: Any, exception: Any): ...
|
||||
def get_response(self, request: WSGIRequest) -> HttpResponseBase: ...
|
||||
def process_exception_by_middleware(self, exception: Exception, request: WSGIRequest) -> HttpResponse: ...
|
||||
def get_response(self, request: HttpRequest) -> HttpResponseBase: ...
|
||||
def process_exception_by_middleware(self, exception: Exception, request: HttpRequest) -> HttpResponse: ...
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from typing import Any, Callable
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse
|
||||
from django.urls.resolvers import URLResolver
|
||||
|
||||
def convert_exception_to_response(get_response: Callable) -> Callable: ...
|
||||
def response_for_exception(request: WSGIRequest, exc: Exception) -> HttpResponse: ...
|
||||
def response_for_exception(request: HttpRequest, exc: Exception) -> HttpResponse: ...
|
||||
def get_exception_response(
|
||||
request: WSGIRequest, resolver: URLResolver, status_code: int, exception: Exception, sender: None = ...
|
||||
request: HttpRequest, resolver: URLResolver, status_code: int, exception: Exception, sender: None = ...
|
||||
) -> HttpResponse: ...
|
||||
def handle_uncaught_exception(request: Any, resolver: Any, exc_info: Any): ...
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
from typing import Any, List, Optional, Tuple
|
||||
|
||||
from django.core.mail.backends.base import BaseEmailBackend
|
||||
from django.core.mail.message import DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE
|
||||
from django.core.mail.message import BadHeaderError as BadHeaderError
|
||||
from django.core.mail.message import EmailMessage as EmailMessage
|
||||
from django.core.mail.message import EmailMultiAlternatives as EmailMultiAlternatives
|
||||
from django.core.mail.message import SafeMIMEMultipart as SafeMIMEMultipart
|
||||
from django.core.mail.message import SafeMIMEText as SafeMIMEText
|
||||
from django.core.mail.message import forbid_multi_line_headers as forbid_multi_line_headers
|
||||
from django.core.mail.utils import DNS_NAME as DNS_NAME
|
||||
from django.core.mail.utils import CachedDnsName as CachedDnsName
|
||||
from .backends.base import BaseEmailBackend
|
||||
from .message import (
|
||||
BadHeaderError as BadHeaderError,
|
||||
DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE,
|
||||
EmailMessage as EmailMessage,
|
||||
EmailMultiAlternatives as EmailMultiAlternatives,
|
||||
SafeMIMEMultipart as SafeMIMEMultipart,
|
||||
SafeMIMEText as SafeMIMEText,
|
||||
forbid_multi_line_headers as forbid_multi_line_headers,
|
||||
)
|
||||
from .utils import CachedDnsName as CachedDnsName, DNS_NAME as DNS_NAME
|
||||
|
||||
def get_connection(backend: Optional[str] = ..., fail_silently: bool = ..., **kwds: Any) -> BaseEmailBackend: ...
|
||||
def send_mail(
|
||||
@@ -18,17 +19,17 @@ def send_mail(
|
||||
from_email: Optional[str],
|
||||
recipient_list: List[str],
|
||||
fail_silently: bool = ...,
|
||||
auth_user: None = ...,
|
||||
auth_password: None = ...,
|
||||
auth_user: Optional[str] = ...,
|
||||
auth_password: Optional[str] = ...,
|
||||
connection: Optional[BaseEmailBackend] = ...,
|
||||
html_message: Optional[str] = ...,
|
||||
) -> int: ...
|
||||
def send_mass_mail(
|
||||
datatuple: List[Tuple[str, str, str, List[str]]],
|
||||
fail_silently: bool = ...,
|
||||
auth_user: None = ...,
|
||||
auth_password: None = ...,
|
||||
connection: BaseEmailBackend = ...,
|
||||
auth_user: Optional[str] = ...,
|
||||
auth_password: Optional[str] = ...,
|
||||
connection: Optional[BaseEmailBackend] = ...,
|
||||
) -> int: ...
|
||||
def mail_admins(
|
||||
subject: str,
|
||||
@@ -45,4 +46,4 @@ def mail_managers(
|
||||
html_message: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
|
||||
outbox = [EmailMessage()]
|
||||
outbox: List[EmailMessage] = ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import email
|
||||
from email._policybase import Policy
|
||||
from email.mime.message import MIMEMessage
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union, Sequence
|
||||
|
||||
from django.core.mail.backends.base import BaseEmailBackend
|
||||
from django.utils.safestring import SafeText
|
||||
@@ -27,14 +27,14 @@ class MIMEMixin:
|
||||
class SafeMIMEMessage(MIMEMixin, MIMEMessage):
|
||||
defects: List[Any]
|
||||
epilogue: None
|
||||
policy: email._policybase.Compat32
|
||||
policy: Policy
|
||||
preamble: None
|
||||
def __setitem__(self, name: str, val: str) -> None: ...
|
||||
|
||||
class SafeMIMEText(MIMEMixin, MIMEText):
|
||||
defects: List[Any]
|
||||
epilogue: None
|
||||
policy: email._policybase.Compat32
|
||||
policy: Policy
|
||||
preamble: None
|
||||
encoding: str = ...
|
||||
def __init__(self, _text: str, _subtype: str = ..., _charset: str = ...) -> None: ...
|
||||
@@ -44,7 +44,7 @@ class SafeMIMEText(MIMEMixin, MIMEText):
|
||||
class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
|
||||
defects: List[Any]
|
||||
epilogue: None
|
||||
policy: email._policybase.Compat32
|
||||
policy: Policy
|
||||
preamble: None
|
||||
encoding: str = ...
|
||||
def __init__(
|
||||
@@ -71,12 +71,12 @@ class EmailMessage:
|
||||
subject: str = ...,
|
||||
body: Optional[str] = ...,
|
||||
from_email: Optional[str] = ...,
|
||||
to: Optional[Union[List[str], Tuple[str, str], str]] = ...,
|
||||
bcc: Optional[Union[List[str], Tuple[str], str]] = ...,
|
||||
to: Optional[Union[Sequence[str], str]] = ...,
|
||||
bcc: Optional[Union[Sequence[str], str]] = ...,
|
||||
connection: Optional[BaseEmailBackend] = ...,
|
||||
attachments: Optional[Union[List[Tuple[str, str]], List[MIMEText]]] = ...,
|
||||
headers: Optional[Dict[str, str]] = ...,
|
||||
cc: Optional[Union[List[str], Tuple[str, str], str]] = ...,
|
||||
cc: Optional[Union[Sequence[str], str]] = ...,
|
||||
reply_to: Optional[Union[List[Optional[str]], str]] = ...,
|
||||
) -> None: ...
|
||||
def get_connection(self, fail_silently: bool = ...) -> BaseEmailBackend: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.core.management.base import BaseCommand as BaseCommand
|
||||
from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError
|
||||
|
||||
def find_commands(management_dir: str) -> List[str]: ...
|
||||
def load_command_class(app_name: str, name: str) -> BaseCommand: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from argparse import ArgumentParser, HelpFormatter, Namespace
|
||||
from io import StringIO, TextIOBase, TextIOWrapper
|
||||
from typing import Any, Callable, List, Optional, Tuple, Union, Type
|
||||
from typing import Any, Callable, List, Optional, Union
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.management.color import Style
|
||||
@@ -9,17 +9,6 @@ class CommandError(Exception): ...
|
||||
class SystemCheckError(CommandError): ...
|
||||
|
||||
class CommandParser(ArgumentParser):
|
||||
add_help: bool
|
||||
allow_abbrev: bool
|
||||
argument_default: None
|
||||
conflict_handler: str
|
||||
description: str
|
||||
epilog: None
|
||||
formatter_class: Type[DjangoHelpFormatter]
|
||||
fromfile_prefix_chars: None
|
||||
prefix_chars: str
|
||||
prog: str
|
||||
usage: None
|
||||
missing_args_message: None = ...
|
||||
called_from_command_line: bool = ...
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
@@ -60,7 +49,7 @@ class BaseCommand:
|
||||
def add_arguments(self, parser: CommandParser) -> None: ...
|
||||
def print_help(self, prog_name: str, subcommand: str) -> None: ...
|
||||
def run_from_argv(self, argv: List[str]) -> None: ...
|
||||
def execute(self, *args: Any, **options: Any) -> Optional[Union[Tuple, str]]: ...
|
||||
def execute(self, *args: Any, **options: Any) -> Any: ...
|
||||
def check(
|
||||
self,
|
||||
app_configs: Optional[List[AppConfig]] = ...,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Dict, List, Optional, Union, Iterable, Sequence
|
||||
from typing import Dict, List, Optional, Union, Iterable, Sequence, Protocol, Any
|
||||
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
@@ -8,13 +8,26 @@ class InvalidPage(Exception): ...
|
||||
class PageNotAnInteger(InvalidPage): ...
|
||||
class EmptyPage(InvalidPage): ...
|
||||
|
||||
class SupportsLen(Protocol):
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class SupportsCount(Protocol):
|
||||
def count(self) -> int: ...
|
||||
|
||||
class SupportsOrdered(Protocol):
|
||||
ordered: bool = ...
|
||||
|
||||
class Paginator:
|
||||
object_list: QuerySet = ...
|
||||
per_page: int = ...
|
||||
orphans: int = ...
|
||||
allow_empty_first_page: bool = ...
|
||||
def __init__(
|
||||
self, object_list: Iterable, per_page: Union[int, str], orphans: int = ..., allow_empty_first_page: bool = ...
|
||||
self,
|
||||
object_list: Union[SupportsLen, SupportsCount, SupportsOrdered],
|
||||
per_page: Union[int, str],
|
||||
orphans: int = ...,
|
||||
allow_empty_first_page: bool = ...,
|
||||
) -> None: ...
|
||||
def validate_number(self, number: Optional[Union[float, str]]) -> int: ...
|
||||
def get_page(self, number: Optional[int]) -> Page: ...
|
||||
|
||||
@@ -2,10 +2,18 @@ from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.serializers.base import Serializer, Deserializer
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
from .base import (
|
||||
Serializer as Serializer,
|
||||
Deserializer as Deserializer,
|
||||
SerializerDoesNotExist as SerializerDoesNotExist,
|
||||
SerializationError as SerializationError,
|
||||
DeserializationError as DeserializationError,
|
||||
M2MDeserializationError as M2MDeserializationError,
|
||||
)
|
||||
|
||||
BUILTIN_SERIALIZERS: Any
|
||||
|
||||
class BadSerializer:
|
||||
@@ -22,7 +30,7 @@ def get_public_serializer_formats() -> List[str]: ...
|
||||
def get_deserializer(format: str) -> Union[Callable, Type[Deserializer]]: ...
|
||||
def serialize(
|
||||
format: str, queryset: Union[Iterator[Any], List[Model], QuerySet], **options: Any
|
||||
) -> Optional[Union[List[OrderedDict], bytes, str]]: ...
|
||||
) -> Optional[Union[bytes, str]]: ...
|
||||
def deserialize(format: str, stream_or_string: Any, **options: Any) -> Union[Iterator[Any], Deserializer]: ...
|
||||
def sort_dependencies(
|
||||
app_list: Union[List[Tuple[AppConfig, None]], List[Tuple[str, List[Type[Model]]]]]
|
||||
|
||||
@@ -3,7 +3,8 @@ from io import BytesIO
|
||||
from typing import Any, Dict
|
||||
from wsgiref import simple_server
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.handlers.wsgi import WSGIRequest, WSGIHandler
|
||||
from django.core.wsgi import get_wsgi_application as get_wsgi_application
|
||||
|
||||
class WSGIServer(simple_server.WSGIServer):
|
||||
request_queue_size: int = ...
|
||||
@@ -31,3 +32,5 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler):
|
||||
requestline: str = ...
|
||||
request_version: str = ...
|
||||
def handle(self) -> None: ...
|
||||
|
||||
def get_internal_wsgi_application() -> WSGIHandler: ...
|
||||
|
||||
6
django-stubs/core/signals.pyi
Normal file
6
django-stubs/core/signals.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.dispatch import Signal
|
||||
|
||||
request_started: Signal = ...
|
||||
request_finished: Signal = ...
|
||||
got_request_exception: Signal = ...
|
||||
setting_changed: Signal = ...
|
||||
@@ -1,5 +1,5 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Type, Union
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, Dict, List, Optional, Type, Union, Protocol
|
||||
|
||||
from django.contrib.sessions.serializers import PickleSerializer
|
||||
|
||||
@@ -11,38 +11,30 @@ def b64_decode(s: bytes) -> bytes: ...
|
||||
def base64_hmac(salt: str, value: Union[bytes, str], key: Union[bytes, str]) -> str: ...
|
||||
def get_cookie_signer(salt: str = ...) -> TimestampSigner: ...
|
||||
|
||||
class Serializer(Protocol):
|
||||
def dumps(self, obj: Any) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Any: ...
|
||||
|
||||
class JSONSerializer:
|
||||
def dumps(self, obj: Union[Dict[str, Union[int, str]], List[str], str]) -> bytes: ...
|
||||
def dumps(self, obj: Any) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Dict[str, Union[int, str]]: ...
|
||||
|
||||
def dumps(
|
||||
obj: Union[Dict[str, Union[datetime, str]], List[str], str],
|
||||
key: None = ...,
|
||||
salt: str = ...,
|
||||
serializer: Type[Union[PickleSerializer, JSONSerializer]] = ...,
|
||||
compress: bool = ...,
|
||||
obj: Any, key: None = ..., salt: str = ..., serializer: Type[Serializer] = ..., compress: bool = ...
|
||||
) -> str: ...
|
||||
def loads(
|
||||
s: str,
|
||||
key: None = ...,
|
||||
salt: str = ...,
|
||||
serializer: Type[Union[PickleSerializer, JSONSerializer]] = ...,
|
||||
max_age: Optional[int] = ...,
|
||||
) -> Union[Dict[str, Union[datetime, str]], Dict[str, Union[int, str]], List[str], str]: ...
|
||||
s: str, key: None = ..., salt: str = ..., serializer: Type[Serializer] = ..., max_age: Optional[int] = ...
|
||||
) -> Any: ...
|
||||
|
||||
class Signer:
|
||||
key: str = ...
|
||||
sep: str = ...
|
||||
salt: Any = ...
|
||||
salt: str = ...
|
||||
def __init__(self, key: Optional[Union[bytes, str]] = ..., sep: str = ..., salt: Optional[str] = ...) -> None: ...
|
||||
def signature(self, value: Union[bytes, str]) -> str: ...
|
||||
def sign(self, value: str) -> str: ...
|
||||
def unsign(self, signed_value: str) -> str: ...
|
||||
|
||||
class TimestampSigner(Signer):
|
||||
key: str
|
||||
salt: str
|
||||
sep: str
|
||||
def timestamp(self) -> str: ...
|
||||
def sign(self, value: str) -> str: ...
|
||||
def unsign(self, value: str, max_age: Optional[int] = ...) -> str: ...
|
||||
def unsign(self, value: str, max_age: Optional[Union[int, timedelta]] = ...) -> str: ...
|
||||
|
||||
@@ -5,6 +5,7 @@ from typing import Any, Dict, List, Optional, Union, Pattern
|
||||
from uuid import UUID
|
||||
|
||||
from django.core.files.base import File
|
||||
from django.core.exceptions import ValidationError as ValidationError
|
||||
|
||||
EMPTY_VALUES: Any
|
||||
|
||||
|
||||
@@ -11,16 +11,20 @@ from .utils import (
|
||||
NotSupportedError as NotSupportedError,
|
||||
InternalError as InternalError,
|
||||
InterfaceError as InterfaceError,
|
||||
ConnectionHandler as ConnectionHandler,
|
||||
Error as Error,
|
||||
ConnectionDoesNotExist as ConnectionDoesNotExist,
|
||||
)
|
||||
|
||||
from . import migrations
|
||||
|
||||
connections: Any
|
||||
router: Any
|
||||
connection: Any
|
||||
|
||||
class DefaultConnectionProxy:
|
||||
def __getattr__(self, item: str) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
|
||||
connection: Any
|
||||
def close_old_connections(**kwargs): ...
|
||||
|
||||
@@ -11,7 +11,6 @@ class Node:
|
||||
parents: Set[Any] = ...
|
||||
def __init__(self, key: Tuple[str, str]) -> None: ...
|
||||
def __lt__(self, other: Union[Tuple[str, str], Node]) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __getitem__(self, item: int) -> str: ...
|
||||
def add_child(self, child: Node) -> None: ...
|
||||
def add_parent(self, parent: Node) -> None: ...
|
||||
@@ -19,13 +18,9 @@ class Node:
|
||||
def descendants(self) -> List[Tuple[str, str]]: ...
|
||||
|
||||
class DummyNode(Node):
|
||||
children: Set[Any]
|
||||
key: Tuple[str, str]
|
||||
parents: Set[Any]
|
||||
origin: Any = ...
|
||||
error_message: Any = ...
|
||||
def __init__(self, key: Tuple[str, str], origin: Migration, error_message: str) -> None: ...
|
||||
__class__: Any = ...
|
||||
def __init__(self, key: Tuple[str, str], origin: Union[Migration, str], error_message: str) -> None: ...
|
||||
def promote(self) -> None: ...
|
||||
def raise_error(self) -> None: ...
|
||||
|
||||
@@ -35,7 +30,7 @@ class MigrationGraph:
|
||||
cached: bool = ...
|
||||
def __init__(self) -> None: ...
|
||||
def add_node(self, key: Tuple[str, str], migration: Optional[Migration]) -> None: ...
|
||||
def add_dummy_node(self, key: Tuple[str, str], origin: Migration, error_message: str) -> None: ...
|
||||
def add_dummy_node(self, key: Tuple[str, str], origin: Union[Migration, str], error_message: str) -> None: ...
|
||||
def add_dependency(
|
||||
self,
|
||||
migration: Optional[Union[Migration, str]],
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from typing import Any, Dict, Optional, Set, Tuple, Union
|
||||
from typing import Any, Dict, Optional, Sequence, Set, Tuple, Union
|
||||
|
||||
from django.db import DefaultConnectionProxy
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.migrations.migration import Migration, SwappableTuple
|
||||
from django.db.migrations.state import ProjectState
|
||||
|
||||
from django.db import DefaultConnectionProxy
|
||||
|
||||
MIGRATIONS_MODULE_NAME: str
|
||||
|
||||
class MigrationLoader:
|
||||
@@ -34,4 +34,6 @@ class MigrationLoader:
|
||||
def build_graph(self) -> None: ...
|
||||
def check_consistent_history(self, connection: Any) -> None: ...
|
||||
def detect_conflicts(self) -> Dict[str, Set[str]]: ...
|
||||
def project_state(self, nodes: Optional[Tuple[str, str]] = ..., at_end: bool = ...) -> ProjectState: ...
|
||||
def project_state(
|
||||
self, nodes: Optional[Tuple[str, str], Sequence[Tuple[str, str]]] = ..., at_end: bool = ...
|
||||
) -> ProjectState: ...
|
||||
|
||||
@@ -13,7 +13,6 @@ class Migration:
|
||||
name: str = ...
|
||||
app_label: str = ...
|
||||
def __init__(self, name: str, app_label: str) -> None: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def mutate_state(self, project_state: ProjectState, preserve: bool = ...) -> ProjectState: ...
|
||||
def apply(
|
||||
self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ...
|
||||
@@ -24,6 +23,6 @@ class Migration:
|
||||
|
||||
class SwappableTuple(tuple):
|
||||
setting: str = ...
|
||||
def __new__(cls: Type[SwappableTuple], value: Tuple[str, str], setting: str) -> SwappableTuple: ...
|
||||
def __new__(cls, value: Tuple[str, str], setting: str) -> SwappableTuple: ...
|
||||
|
||||
def swappable_dependency(value: str) -> SwappableTuple: ...
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for django.db.migrations.operations (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .fields import (
|
||||
AddField as AddField,
|
||||
AlterField as AlterField,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional, Type
|
||||
from typing import Any, List
|
||||
|
||||
class Operation:
|
||||
reversible: bool = ...
|
||||
@@ -6,7 +6,6 @@ class Operation:
|
||||
atomic: bool = ...
|
||||
elidable: bool = ...
|
||||
serialization_expand_args: Any = ...
|
||||
def __new__(cls: Type[Operation], *args: Any, **kwargs: Any) -> Operation: ...
|
||||
def deconstruct(self): ...
|
||||
def state_forwards(self, app_label: Any, state: Any) -> None: ...
|
||||
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
|
||||
from typing import Any, Collection, Dict, List, Optional, Sequence, Tuple, Union
|
||||
|
||||
from django.db.migrations.operations.base import Operation
|
||||
from django.db.models.indexes import Index
|
||||
@@ -12,18 +12,17 @@ class ModelOperation(Operation):
|
||||
def name_lower(self) -> str: ...
|
||||
|
||||
class CreateModel(ModelOperation):
|
||||
serialization_expand_args: Any = ...
|
||||
fields: Any = ...
|
||||
fields: Sequence[Tuple[str, Field]] = ...
|
||||
options: Any = ...
|
||||
bases: Any = ...
|
||||
managers: Any = ...
|
||||
bases: Optional[Sequence[Union[type, str]]] = ...
|
||||
managers: Optional[Sequence[Tuple[str, Manager]]] = ...
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
fields: List[Tuple[str, Field]],
|
||||
fields: Sequence[Tuple[str, Field]],
|
||||
options: Optional[Dict[str, Any]] = ...,
|
||||
bases: Optional[Union[Tuple[Type[Any], ...], Tuple[str, ...]]] = ...,
|
||||
managers: Optional[List[Tuple[str, Manager]]] = ...,
|
||||
bases: Optional[Sequence[Union[type, str]]] = ...,
|
||||
managers: Optional[Sequence[Tuple[str, Manager]]] = ...,
|
||||
) -> None: ...
|
||||
def model_to_key(self, model: str) -> List[str]: ...
|
||||
|
||||
@@ -45,13 +44,13 @@ class FieldRelatedOptionOperation(ModelOptionOperation): ...
|
||||
|
||||
class AlterUniqueTogether(FieldRelatedOptionOperation):
|
||||
option_name: str = ...
|
||||
unique_together: Any = ...
|
||||
def __init__(self, name: str, unique_together: Set[Tuple[str, ...]]) -> None: ...
|
||||
unique_together: Collection[Sequence[str]] = ...
|
||||
def __init__(self, name: str, unique_together: Optional[Collection[Sequence[str]]]) -> None: ...
|
||||
|
||||
class AlterIndexTogether(FieldRelatedOptionOperation):
|
||||
option_name: str = ...
|
||||
index_together: Set[Tuple[str, ...]] = ...
|
||||
def __init__(self, name: str, index_together: Set[Tuple[str, ...]]) -> None: ...
|
||||
index_together: Collection[Sequence[str]] = ...
|
||||
def __init__(self, name: str, index_together: Optional[Collection[Sequence[str]]]) -> None: ...
|
||||
|
||||
class AlterOrderWithRespectTo(FieldRelatedOptionOperation):
|
||||
order_with_respect_to: str = ...
|
||||
@@ -63,7 +62,6 @@ class AlterModelOptions(ModelOptionOperation):
|
||||
def __init__(self, name: str, options: Dict[str, Any]) -> None: ...
|
||||
|
||||
class AlterModelManagers(ModelOptionOperation):
|
||||
serialization_expand_args: Any = ...
|
||||
managers: Any = ...
|
||||
def __init__(self, name: Any, managers: Any) -> None: ...
|
||||
|
||||
@@ -74,9 +72,9 @@ class IndexOperation(Operation):
|
||||
class AddIndex(IndexOperation):
|
||||
model_name: str = ...
|
||||
index: Index = ...
|
||||
def __init__(self, model_name: str, index: Index) -> None: ...
|
||||
def __init__(self, model_name: str, index: Union[str, Index]) -> None: ...
|
||||
|
||||
class RemoveIndex(IndexOperation):
|
||||
model_name: str = ...
|
||||
name: str = ...
|
||||
def __init__(self, model_name: str, name: str) -> None: ...
|
||||
def __init__(self, model_name: str, name: Union[str, Index]) -> None: ...
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
from typing import Any, Callable, List, Optional
|
||||
from typing import Any, Callable, Dict, Optional, Sequence
|
||||
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
from django.db.migrations.operations.models import CreateModel
|
||||
from django.db.migrations.state import ProjectState, StateApps
|
||||
from django.db.migrations.state import StateApps
|
||||
|
||||
from .base import Operation
|
||||
|
||||
class SeparateDatabaseAndState(Operation):
|
||||
serialization_expand_args: Any = ...
|
||||
database_operations: Any = ...
|
||||
state_operations: Any = ...
|
||||
def __init__(self, database_operations: List[Any] = ..., state_operations: List[CreateModel] = ...) -> None: ...
|
||||
database_operations: Sequence[Operation] = ...
|
||||
state_operations: Sequence[Operation] = ...
|
||||
def __init__(
|
||||
self, database_operations: Sequence[Operation] = ..., state_operations: Sequence[Operation] = ...
|
||||
) -> None: ...
|
||||
|
||||
class RunSQL(Operation):
|
||||
noop: str = ...
|
||||
@@ -18,7 +18,6 @@ class RunSQL(Operation):
|
||||
reverse_sql: Any = ...
|
||||
state_operations: Any = ...
|
||||
hints: Any = ...
|
||||
elidable: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
sql: Any,
|
||||
@@ -29,18 +28,15 @@ class RunSQL(Operation):
|
||||
) -> None: ...
|
||||
|
||||
class RunPython(Operation):
|
||||
reduces_to_sql: bool = ...
|
||||
atomic: Any = ...
|
||||
code: Any = ...
|
||||
reverse_code: Any = ...
|
||||
hints: Any = ...
|
||||
elidable: Any = ...
|
||||
code: Callable = ...
|
||||
reverse_code: Optional[Callable] = ...
|
||||
hints: Optional[Dict[str, Any]] = ...
|
||||
def __init__(
|
||||
self,
|
||||
code: Callable,
|
||||
reverse_code: Optional[Callable] = ...,
|
||||
atomic: Optional[bool] = ...,
|
||||
hints: None = ...,
|
||||
hints: Optional[Dict[str, Any]] = ...,
|
||||
elidable: bool = ...,
|
||||
) -> None: ...
|
||||
@staticmethod
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.db.migrations.state import ProjectState
|
||||
|
||||
from django.db.models.fields import Field
|
||||
|
||||
def is_referenced_by_foreign_key(state: ProjectState, model_name_lower: str, field: Field, field_name: str) -> bool: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import List, Optional
|
||||
|
||||
from django.db.migrations.operations.base import Operation
|
||||
|
||||
class MigrationOptimizer:
|
||||
def optimize(self, operations: List[Operation], app_label: str = ...) -> List[Operation]: ...
|
||||
def optimize_inner(self, operations: List[Operation], app_label: str = ...) -> List[Operation]: ...
|
||||
def optimize(self, operations: List[Operation], app_label: Optional[str] = ...) -> List[Operation]: ...
|
||||
def optimize_inner(self, operations: List[Operation], app_label: Optional[str] = ...) -> List[Operation]: ...
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
from typing import Any, Dict, Optional, Set
|
||||
|
||||
from django.db.migrations.state import ModelState
|
||||
|
||||
from django.db.models.fields import Field
|
||||
|
||||
from .loader import MigrationLoader
|
||||
|
||||
class MigrationQuestioner:
|
||||
defaults: Dict[Any, Any] = ...
|
||||
specified_apps: Set[Any] = ...
|
||||
dry_run: None = ...
|
||||
defaults: Dict[str, Any] = ...
|
||||
specified_apps: Set[str] = ...
|
||||
dry_run: Optional[bool] = ...
|
||||
def __init__(
|
||||
self,
|
||||
defaults: Optional[Dict[str, bool]] = ...,
|
||||
@@ -23,21 +22,5 @@ class MigrationQuestioner:
|
||||
def ask_merge(self, app_label: str) -> bool: ...
|
||||
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> None: ...
|
||||
|
||||
class InteractiveMigrationQuestioner(MigrationQuestioner):
|
||||
defaults: Dict[Any, Any]
|
||||
dry_run: bool
|
||||
specified_apps: Set[str]
|
||||
def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ...
|
||||
def ask_not_null_alteration(self, field_name: Any, model_name: Any): ...
|
||||
def ask_rename(self, model_name: Any, old_name: Any, new_name: Any, field_instance: Any): ...
|
||||
def ask_rename_model(self, old_model_state: Any, new_model_state: Any): ...
|
||||
def ask_merge(self, app_label: str) -> bool: ...
|
||||
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> int: ...
|
||||
|
||||
class NonInteractiveMigrationQuestioner(MigrationQuestioner):
|
||||
defaults: Dict[Any, Any]
|
||||
dry_run: bool
|
||||
specified_apps: Set[str]
|
||||
def ask_not_null_addition(self, field_name: Any, model_name: Any) -> None: ...
|
||||
def ask_not_null_alteration(self, field_name: Any, model_name: Any): ...
|
||||
def ask_auto_now_add_addition(self, field_name: Any, model_name: Any) -> None: ...
|
||||
class InteractiveMigrationQuestioner(MigrationQuestioner): ...
|
||||
class NonInteractiveMigrationQuestioner(MigrationQuestioner): ...
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
from typing import Any, Optional, Set, Tuple, Union
|
||||
from typing import Any, Optional, Set, Tuple
|
||||
|
||||
from django.db import models
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
from django.db import models
|
||||
|
||||
class MigrationRecorder:
|
||||
class Migration(models.Model):
|
||||
app: Any = ...
|
||||
name: Any = ...
|
||||
applied: Any = ...
|
||||
class Meta:
|
||||
apps: Any = ...
|
||||
app_label: str = ...
|
||||
db_table: str = ...
|
||||
connection: Optional[BaseDatabaseWrapper] = ...
|
||||
def __init__(self, connection: Optional[BaseDatabaseWrapper]) -> None: ...
|
||||
@property
|
||||
|
||||
@@ -1,88 +1,40 @@
|
||||
from typing import Any, Callable, Dict, List, Set, Tuple, Union
|
||||
|
||||
from django.db.models.fields import Field
|
||||
|
||||
class BaseSerializer:
|
||||
value: Any = ...
|
||||
def __init__(self, value: Any) -> None: ...
|
||||
def serialize(self) -> None: ...
|
||||
def serialize(self) -> Any: ...
|
||||
|
||||
class BaseSequenceSerializer(BaseSerializer):
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
class BaseSimpleSerializer(BaseSerializer):
|
||||
value: str
|
||||
def serialize(self) -> Tuple[str, Set[Any]]: ...
|
||||
|
||||
class DatetimeSerializer(BaseSerializer):
|
||||
value: Any = ...
|
||||
def serialize(self): ...
|
||||
|
||||
class DateSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class DecimalSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
class BaseSequenceSerializer(BaseSerializer): ...
|
||||
class BaseSimpleSerializer(BaseSerializer): ...
|
||||
class DatetimeSerializer(BaseSerializer): ...
|
||||
class DateSerializer(BaseSerializer): ...
|
||||
class DecimalSerializer(BaseSerializer): ...
|
||||
|
||||
class DeconstructableSerializer(BaseSerializer):
|
||||
@staticmethod
|
||||
def serialize_deconstructed(
|
||||
path: str, args: List[Any], kwargs: Dict[str, Union[Callable, int, str]]
|
||||
) -> Tuple[str, Set[str]]: ...
|
||||
def serialize(self): ...
|
||||
|
||||
class DictionarySerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class EnumSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class FloatSerializer(BaseSimpleSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class DictionarySerializer(BaseSerializer): ...
|
||||
class EnumSerializer(BaseSerializer): ...
|
||||
class FloatSerializer(BaseSimpleSerializer): ...
|
||||
class FrozensetSerializer(BaseSequenceSerializer): ...
|
||||
|
||||
class FunctionTypeSerializer(BaseSerializer):
|
||||
value: Callable
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
class FunctoolsPartialSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class IterableSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class ModelFieldSerializer(DeconstructableSerializer):
|
||||
value: Field
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
class ModelManagerSerializer(DeconstructableSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class OperationSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class RegexSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class FunctionTypeSerializer(BaseSerializer): ...
|
||||
class FunctoolsPartialSerializer(BaseSerializer): ...
|
||||
class IterableSerializer(BaseSerializer): ...
|
||||
class ModelFieldSerializer(DeconstructableSerializer): ...
|
||||
class ModelManagerSerializer(DeconstructableSerializer): ...
|
||||
class OperationSerializer(BaseSerializer): ...
|
||||
class RegexSerializer(BaseSerializer): ...
|
||||
class SequenceSerializer(BaseSequenceSerializer): ...
|
||||
class SetSerializer(BaseSequenceSerializer): ...
|
||||
|
||||
class SettingsReferenceSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class TimedeltaSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class TimeSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class SettingsReferenceSerializer(BaseSerializer): ...
|
||||
class TimedeltaSerializer(BaseSerializer): ...
|
||||
class TimeSerializer(BaseSerializer): ...
|
||||
class TupleSerializer(BaseSequenceSerializer): ...
|
||||
|
||||
class TypeSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
|
||||
class UUIDSerializer(BaseSerializer):
|
||||
def serialize(self): ...
|
||||
class TypeSerializer(BaseSerializer): ...
|
||||
class UUIDSerializer(BaseSerializer): ...
|
||||
|
||||
def serializer_factory(value: Any) -> BaseSerializer: ...
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, DefaultDict
|
||||
from typing import Any, DefaultDict, Dict, Iterator, List, Optional, Sequence, Tuple, Type, Union
|
||||
|
||||
from django.apps.registry import Apps
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.manager import Manager
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
from django.db.models.fields import Field
|
||||
|
||||
@@ -19,13 +18,19 @@ class AppConfigStub:
|
||||
def import_models(self) -> None: ...
|
||||
|
||||
class ModelState:
|
||||
name: str
|
||||
app_label: str
|
||||
fields: List[Tuple[str, Field]]
|
||||
options: Dict[str, Any] = ...
|
||||
bases: Tuple[Type[Model]] = ...
|
||||
managers: List[Tuple[str, Manager]] = ...
|
||||
def __init__(
|
||||
self,
|
||||
app_label: str,
|
||||
name: str,
|
||||
fields: List[Tuple[str, Field]],
|
||||
options: Optional[Dict[str, Any]] = ...,
|
||||
bases: Optional[Tuple[Type[Model]]] = ...,
|
||||
bases: Optional[Sequence[Union[Type[Model], str]]] = ...,
|
||||
managers: Optional[List[Tuple[str, Manager]]] = ...,
|
||||
) -> None: ...
|
||||
def clone(self) -> ModelState: ...
|
||||
@@ -33,9 +38,9 @@ class ModelState:
|
||||
@classmethod
|
||||
def from_model(cls, model: Type[Model], exclude_rels: bool = ...) -> ModelState: ...
|
||||
def get_field_by_name(self, name: str) -> Field: ...
|
||||
@cached_property
|
||||
@property
|
||||
def name_lower(self) -> str: ...
|
||||
def render(self, apps: StateApps) -> Any: ...
|
||||
def render(self, apps: Apps) -> Any: ...
|
||||
|
||||
class ProjectState:
|
||||
is_delayed: bool
|
||||
@@ -45,7 +50,7 @@ class ProjectState:
|
||||
self, models: Optional[Dict[Tuple[str, str], ModelState]] = ..., real_apps: Optional[List[str]] = ...
|
||||
) -> None: ...
|
||||
def add_model(self, model_state: ModelState) -> None: ...
|
||||
@cached_property
|
||||
@property
|
||||
def apps(self) -> StateApps: ...
|
||||
def clear_delayed_apps_cache(self) -> None: ...
|
||||
def clone(self) -> ProjectState: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, Iterator, List, Optional, Set
|
||||
from typing import Dict, Iterator, List, Set
|
||||
|
||||
from django.db.migrations.operations.base import Operation
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
from typing import Any
|
||||
|
||||
COMPILED_REGEX_TYPE: Any
|
||||
|
||||
class RegexObject:
|
||||
pattern: str = ...
|
||||
flags: int = ...
|
||||
def __init__(self, obj: SimpleLazyObject) -> None: ...
|
||||
def __init__(self, obj: Any) -> None: ...
|
||||
|
||||
def get_migration_name_timestamp() -> str: ...
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
from typing import Any, Optional, Set, Tuple, Type, List
|
||||
from typing import Any, List, Set, Tuple, Union
|
||||
|
||||
from django.db.migrations.migration import Migration
|
||||
from django.db.migrations.operations.base import Operation
|
||||
|
||||
from django.db.migrations.operations.models import CreateModel
|
||||
|
||||
class SettingsReference(str):
|
||||
def __new__(self: Type[SettingsReference], value: str, setting_name: str) -> SettingsReference: ...
|
||||
setting_name: str = ...
|
||||
def __init__(self, value: str, setting_name: str) -> None: ...
|
||||
|
||||
class OperationWriter:
|
||||
@@ -24,7 +21,7 @@ class OperationWriter:
|
||||
class MigrationWriter:
|
||||
migration: Migration = ...
|
||||
needs_manual_porting: bool = ...
|
||||
def __init__(self, migration: Migration) -> None: ...
|
||||
def __init__(self, migration: Union[type, Migration]) -> None: ...
|
||||
def as_string(self) -> str: ...
|
||||
@property
|
||||
def basedir(self) -> str: ...
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
from .base import Model as Model
|
||||
|
||||
from .aggregates import Aggregate as Aggregate, Sum as Sum, Variance as Variance, Count as Count, Max as Max
|
||||
from .aggregates import (
|
||||
Aggregate as Aggregate,
|
||||
Avg as Avg,
|
||||
Count as Count,
|
||||
Max as Max,
|
||||
Min as Min,
|
||||
StdDev as StdDev,
|
||||
Sum as Sum,
|
||||
Variance as Variance,
|
||||
)
|
||||
|
||||
from .fields import (
|
||||
FieldDoesNotExist as FieldDoesNotExist,
|
||||
AutoField as AutoField,
|
||||
IntegerField as IntegerField,
|
||||
PositiveIntegerField as PositiveIntegerField,
|
||||
@@ -28,6 +38,8 @@ from .fields import (
|
||||
FilePathField as FilePathField,
|
||||
BinaryField as BinaryField,
|
||||
DurationField as DurationField,
|
||||
BigAutoField as BigAutoField,
|
||||
CommaSeparatedIntegerField as CommaSeparatedIntegerField,
|
||||
)
|
||||
|
||||
from .fields.related import (
|
||||
@@ -35,8 +47,18 @@ from .fields.related import (
|
||||
OneToOneField as OneToOneField,
|
||||
ManyToManyField as ManyToManyField,
|
||||
ForeignObject as ForeignObject,
|
||||
ManyToManyRel as ManyToManyRel,
|
||||
ManyToOneRel as ManyToOneRel,
|
||||
OneToOneRel as OneToOneRel,
|
||||
ForeignObjectRel as ForeignObjectRel,
|
||||
)
|
||||
from .fields.files import ImageField as ImageField, FileField as FileField
|
||||
from .fields.files import (
|
||||
ImageField as ImageField,
|
||||
FileField as FileField,
|
||||
FieldFile as FieldFile,
|
||||
FileDescriptor as FileDescriptor,
|
||||
)
|
||||
from .fields.proxy import OrderWrt as OrderWrt
|
||||
|
||||
from .deletion import (
|
||||
CASCADE as CASCADE,
|
||||
@@ -44,9 +66,15 @@ from .deletion import (
|
||||
SET_NULL as SET_NULL,
|
||||
DO_NOTHING as DO_NOTHING,
|
||||
PROTECT as PROTECT,
|
||||
SET as SET,
|
||||
)
|
||||
|
||||
from .query import QuerySet as QuerySet, RawQuerySet as RawQuerySet
|
||||
from .query import (
|
||||
Prefetch as Prefetch,
|
||||
QuerySet as QuerySet,
|
||||
RawQuerySet as RawQuerySet,
|
||||
prefetch_related_objects as prefetch_related_objects,
|
||||
)
|
||||
|
||||
from .query_utils import Q as Q, FilteredRelation as FilteredRelation
|
||||
|
||||
@@ -64,8 +92,29 @@ from .expressions import (
|
||||
RawSQL as RawSQL,
|
||||
Value as Value,
|
||||
Func as Func,
|
||||
ExpressionWrapper as ExpressionWrapper,
|
||||
Combinable as Combinable,
|
||||
Col as Col,
|
||||
CombinedExpression as CombinedExpression,
|
||||
ExpressionList as ExpressionList,
|
||||
Random as Random,
|
||||
Ref as Ref,
|
||||
)
|
||||
|
||||
from .manager import BaseManager as BaseManager, Manager as Manager
|
||||
|
||||
from . import lookups as lookups
|
||||
|
||||
from .aggregates import (
|
||||
Avg as Avg,
|
||||
Min as Min,
|
||||
Max as Max,
|
||||
Variance as Variance,
|
||||
StdDev as StdDev,
|
||||
Sum as Sum,
|
||||
Aggregate as Aggregate,
|
||||
)
|
||||
|
||||
from .indexes import Index as Index
|
||||
|
||||
from . import signals as signals
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
from typing import Any, List, Optional, Set, Tuple, Dict
|
||||
from typing import Any, Dict, List, Optional, Set, Tuple, TypeVar, Union, ClassVar, Sequence, Generic
|
||||
|
||||
from django.db.models.manager import Manager
|
||||
|
||||
class ModelBase(type): ...
|
||||
|
||||
_Self = TypeVar("_Self", bound="Model")
|
||||
|
||||
class Model(metaclass=ModelBase):
|
||||
class DoesNotExist(Exception):
|
||||
pass
|
||||
class DoesNotExist(Exception): ...
|
||||
class Meta: ...
|
||||
_meta: Any
|
||||
_default_manager: Manager[Model]
|
||||
pk: Any = ...
|
||||
objects: Manager[Model]
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def __init__(self: _Self, *args, **kwargs) -> None: ...
|
||||
def delete(self, using: Any = ..., keep_parents: bool = ...) -> Tuple[int, Dict[str, int]]: ...
|
||||
def full_clean(self, exclude: Optional[List[str]] = ..., validate_unique: bool = ...) -> None: ...
|
||||
def clean_fields(self, exclude: List[str] = ...) -> None: ...
|
||||
@@ -19,7 +22,22 @@ class Model(metaclass=ModelBase):
|
||||
force_insert: bool = ...,
|
||||
force_update: bool = ...,
|
||||
using: Optional[str] = ...,
|
||||
update_fields: Optional[List[str]] = ...,
|
||||
update_fields: Optional[Union[Sequence[str], str]] = ...,
|
||||
) -> None: ...
|
||||
def refresh_from_db(self, using: None = ..., fields: Optional[List[str]] = ...) -> None: ...
|
||||
def save_base(
|
||||
self,
|
||||
raw: bool = ...,
|
||||
force_insert: bool = ...,
|
||||
force_update: bool = ...,
|
||||
using: Optional[str] = ...,
|
||||
update_fields: Optional[Union[Sequence[str], str]] = ...,
|
||||
): ...
|
||||
def refresh_from_db(self: _Self, using: Optional[str] = ..., fields: Optional[List[str]] = ...) -> _Self: ...
|
||||
def get_deferred_fields(self) -> Set[str]: ...
|
||||
|
||||
class ModelStateFieldsCacheDescriptor: ...
|
||||
|
||||
class ModelState:
|
||||
db: None = ...
|
||||
adding: bool = ...
|
||||
fields_cache: ModelStateFieldsCacheDescriptor = ...
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
from typing import Any, Callable
|
||||
|
||||
from django.db import IntegrityError
|
||||
|
||||
def CASCADE(collector, field, sub_objs, using): ...
|
||||
def SET_NULL(collector, field, sub_objs, using): ...
|
||||
def SET_DEFAULT(collector, field, sub_objs, using): ...
|
||||
def DO_NOTHING(collector, field, sub_objs, using): ...
|
||||
def PROTECT(collector, field, sub_objs, using): ...
|
||||
def SET(value: Any) -> Callable: ...
|
||||
|
||||
class ProtectedError(IntegrityError): ...
|
||||
class Collector: ...
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
from collections import OrderedDict
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, Union, TypeVar
|
||||
|
||||
from django.db.models import QuerySet
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.lookups import Lookup
|
||||
from django.db.models.sql import Query
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
|
||||
from django.db.models import Q, QuerySet
|
||||
from django.db.models.fields import Field, FloatField
|
||||
from django.db.models.sql import Query
|
||||
|
||||
_OutputField = Union[Field, str]
|
||||
|
||||
class SQLiteNumericMixin:
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: Any, **extra_context: Any) -> Tuple[str, List[float]]: ...
|
||||
|
||||
_SelfCombinable = TypeVar("_SelfCombinable", bound="Combinable")
|
||||
|
||||
class Combinable:
|
||||
ADD: str = ...
|
||||
SUB: str = ...
|
||||
@@ -22,37 +27,41 @@ class Combinable:
|
||||
BITOR: str = ...
|
||||
BITLEFTSHIFT: str = ...
|
||||
BITRIGHTSHIFT: str = ...
|
||||
def __neg__(self) -> CombinedExpression: ...
|
||||
def __add__(self, other: Optional[Union[timedelta, Combinable, float, str]]) -> CombinedExpression: ...
|
||||
def __sub__(self, other: Union[timedelta, Combinable, float]) -> CombinedExpression: ...
|
||||
def __mul__(self, other: Union[timedelta, Combinable, float]) -> CombinedExpression: ...
|
||||
def __truediv__(self, other: float) -> CombinedExpression: ...
|
||||
def __mod__(self, other: int) -> CombinedExpression: ...
|
||||
def __pow__(self, other: float) -> CombinedExpression: ...
|
||||
def __and__(self, other: Combinable) -> Any: ...
|
||||
def bitand(self, other: int) -> CombinedExpression: ...
|
||||
def bitleftshift(self, other: int) -> CombinedExpression: ...
|
||||
def bitrightshift(self, other: int) -> CombinedExpression: ...
|
||||
def __or__(self, other: Combinable) -> Any: ...
|
||||
def bitor(self, other: int) -> CombinedExpression: ...
|
||||
def __radd__(self, other: Optional[Union[datetime, float]]) -> CombinedExpression: ...
|
||||
def __rsub__(self, other: float) -> CombinedExpression: ...
|
||||
def __rmul__(self, other: float) -> CombinedExpression: ...
|
||||
def __rtruediv__(self, other: float) -> CombinedExpression: ...
|
||||
def __rmod__(self, other: int) -> CombinedExpression: ...
|
||||
def __rpow__(self, other: float) -> CombinedExpression: ...
|
||||
def __rand__(self, other: Any) -> Any: ...
|
||||
def __ror__(self, other: Any) -> Any: ...
|
||||
def __neg__(self: _SelfCombinable) -> _SelfCombinable: ...
|
||||
def __add__(
|
||||
self: _SelfCombinable, other: Optional[Union[timedelta, Combinable, float, str]]
|
||||
) -> _SelfCombinable: ...
|
||||
def __sub__(self: _SelfCombinable, other: Union[timedelta, Combinable, float]) -> _SelfCombinable: ...
|
||||
def __mul__(self: _SelfCombinable, other: Union[timedelta, Combinable, float]) -> _SelfCombinable: ...
|
||||
def __truediv__(self: _SelfCombinable, other: Union[Combinable, float]) -> _SelfCombinable: ...
|
||||
def __itruediv__(self: _SelfCombinable, other: Union[Combinable, float]) -> _SelfCombinable: ...
|
||||
def __mod__(self: _SelfCombinable, other: Union[int, Combinable]) -> _SelfCombinable: ...
|
||||
def __pow__(self: _SelfCombinable, other: Union[float, Combinable]) -> _SelfCombinable: ...
|
||||
def __and__(self: _SelfCombinable, other: Combinable) -> _SelfCombinable: ...
|
||||
def bitand(self: _SelfCombinable, other: int) -> _SelfCombinable: ...
|
||||
def bitleftshift(self: _SelfCombinable, other: int) -> _SelfCombinable: ...
|
||||
def bitrightshift(self: _SelfCombinable, other: int) -> _SelfCombinable: ...
|
||||
def __or__(self: _SelfCombinable, other: Combinable) -> _SelfCombinable: ...
|
||||
def bitor(self: _SelfCombinable, other: int) -> _SelfCombinable: ...
|
||||
def __radd__(self, other: Optional[Union[datetime, float, Combinable]]) -> Combinable: ...
|
||||
def __rsub__(self, other: Union[float, Combinable]) -> Combinable: ...
|
||||
def __rmul__(self, other: Union[float, Combinable]) -> Combinable: ...
|
||||
def __rtruediv__(self, other: Union[float, Combinable]) -> Combinable: ...
|
||||
def __rmod__(self, other: Union[int, Combinable]) -> Combinable: ...
|
||||
def __rpow__(self, other: Union[float, Combinable]) -> Combinable: ...
|
||||
def __rand__(self, other: Any) -> Combinable: ...
|
||||
def __ror__(self, other: Any) -> Combinable: ...
|
||||
|
||||
_SelfBaseExpression = TypeVar("_SelfBaseExpression", bound="BaseExpression")
|
||||
|
||||
class BaseExpression:
|
||||
is_summary: bool = ...
|
||||
filterable: bool = ...
|
||||
window_compatible: bool = ...
|
||||
def __init__(self, output_field: Optional[Union[Field, str]] = ...) -> None: ...
|
||||
def __init__(self, output_field: Optional[_OutputField] = ...) -> None: ...
|
||||
def get_db_converters(self, connection: Any) -> List[Callable]: ...
|
||||
def get_source_expressions(self) -> List[Any]: ...
|
||||
def set_source_expressions(self, exprs: List[Any]) -> None: ...
|
||||
def as_sql(self, compiler: Any, connection: Any) -> None: ...
|
||||
def contains_aggregate(self) -> bool: ...
|
||||
def contains_over_clause(self) -> bool: ...
|
||||
def contains_column_references(self) -> bool: ...
|
||||
@@ -71,15 +80,21 @@ class BaseExpression:
|
||||
def convert_value(self) -> Callable: ...
|
||||
def get_lookup(self, lookup: str) -> Optional[Type[Lookup]]: ...
|
||||
def get_transform(self, name: str) -> Optional[Type[Expression]]: ...
|
||||
def relabeled_clone(self, change_map: Union[Dict[Optional[str], str], OrderedDict]) -> Expression: ...
|
||||
def relabeled_clone(self, change_map: Dict[Optional[str], str]) -> Expression: ...
|
||||
def copy(self) -> BaseExpression: ...
|
||||
def get_group_by_cols(self) -> List[Expression]: ...
|
||||
def get_group_by_cols(self: _SelfBaseExpression) -> List[_SelfBaseExpression]: ...
|
||||
def get_source_fields(self) -> List[Optional[Field]]: ...
|
||||
def asc(self, **kwargs: Any) -> Expression: ...
|
||||
def desc(self, **kwargs: Any) -> Expression: ...
|
||||
def reverse_ordering(self): ...
|
||||
def flatten(self) -> Iterator[Expression]: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: Any) -> Any: ...
|
||||
def as_sql(self, compiler: SQLCompiler, connection: Any, **extra_context: Any) -> Any: ...
|
||||
def as_mysql(self, compiler: Any, connection: Any) -> Any: ...
|
||||
def as_postgresql(self, compiler: Any, connection: Any) -> Any: ...
|
||||
def as_oracle(self, compiler: Any, connection: Any): ...
|
||||
|
||||
class Expression(BaseExpression, Combinable): ...
|
||||
|
||||
@@ -87,10 +102,11 @@ class CombinedExpression(SQLiteNumericMixin, Expression):
|
||||
connector: Any = ...
|
||||
lhs: Any = ...
|
||||
rhs: Any = ...
|
||||
def __init__(self, lhs: Combinable, connector: str, rhs: Combinable, output_field: None = ...) -> None: ...
|
||||
def __init__(
|
||||
self, lhs: Combinable, connector: str, rhs: Combinable, output_field: Optional[_OutputField] = ...
|
||||
) -> None: ...
|
||||
def get_source_expressions(self) -> Union[List[Combinable], List[SQLiteNumericMixin]]: ...
|
||||
def set_source_expressions(self, exprs: List[Combinable]) -> None: ...
|
||||
def as_sql(self, compiler: SQLCompiler, connection: Any) -> Any: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Any = ...,
|
||||
@@ -111,14 +127,18 @@ class F(Combinable):
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...,
|
||||
) -> Expression: ...
|
||||
def asc(self, **kwargs) -> OrderBy: ...
|
||||
def desc(self, **kwargs) -> OrderBy: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
|
||||
class OuterRef(F): ...
|
||||
class OuterRef(F):
|
||||
def __init__(self, name: Union[str, OuterRef]): ...
|
||||
|
||||
class Subquery(Expression):
|
||||
template: str = ...
|
||||
queryset: QuerySet = ...
|
||||
extra: Dict[Any, Any] = ...
|
||||
def __init__(self, queryset: QuerySet, output_field: Optional[Field] = ..., **extra: Any) -> None: ...
|
||||
def __init__(self, queryset: QuerySet, output_field: Optional[_OutputField] = ..., **extra: Any) -> None: ...
|
||||
|
||||
class Exists(Subquery):
|
||||
extra: Dict[Any, Any]
|
||||
@@ -139,22 +159,22 @@ class OrderBy(BaseExpression):
|
||||
|
||||
class Value(Expression):
|
||||
value: Any = ...
|
||||
def __init__(self, value: Any, output_field: Optional[Field] = ...) -> None: ...
|
||||
def __init__(self, value: Any, output_field: Optional[_OutputField] = ...) -> None: ...
|
||||
|
||||
class RawSQL(Expression):
|
||||
output_field: Field
|
||||
params: List[Any]
|
||||
sql: str
|
||||
def __init__(self, sql: str, params: Union[List[int], List[str], Tuple], output_field: None = ...) -> None: ...
|
||||
def __init__(self, sql: str, params: Sequence[Any], output_field: Optional[_OutputField] = ...) -> None: ...
|
||||
|
||||
class Func(SQLiteNumericMixin, Expression):
|
||||
function: Any = ...
|
||||
function: str = ...
|
||||
template: str = ...
|
||||
arg_joiner: str = ...
|
||||
arity: Any = ...
|
||||
arity: int = ...
|
||||
source_expressions: List[Expression] = ...
|
||||
extra: Any = ...
|
||||
def __init__(self, *expressions: Any, output_field: Optional[Any] = ..., **extra: Any) -> None: ...
|
||||
extra: Dict[Any, Any] = ...
|
||||
def __init__(self, *expressions: Any, output_field: Optional[_OutputField] = ..., **extra: Any) -> None: ...
|
||||
def get_source_expressions(self) -> List[Combinable]: ...
|
||||
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
|
||||
def resolve_expression(
|
||||
@@ -180,5 +200,22 @@ class Case(Expression):
|
||||
default: Any = ...
|
||||
extra: Any = ...
|
||||
def __init__(
|
||||
self, *cases: Any, default: Optional[Any] = ..., output_field: Optional[Any] = ..., **extra: Any
|
||||
self, *cases: Any, default: Optional[Any] = ..., output_field: Optional[_OutputField] = ..., **extra: Any
|
||||
) -> None: ...
|
||||
|
||||
class ExpressionWrapper(Expression):
|
||||
def __init__(self, expression: Union[Q, Combinable], output_field: _OutputField): ...
|
||||
def set_source_expressions(self, exprs: Sequence[Expression]) -> None: ...
|
||||
def get_source_expressions(self) -> List[Expression]: ...
|
||||
|
||||
class Col(Expression):
|
||||
def __init__(self, alias: str, target: str, output_field: Optional[_OutputField] = ...): ...
|
||||
|
||||
class ExpressionList(Func):
|
||||
def __init__(self, *expressions: Union[BaseExpression, Combinable], **extra: Any) -> None: ...
|
||||
|
||||
class Random(Expression):
|
||||
output_field: FloatField
|
||||
|
||||
class Ref(Expression):
|
||||
def __init__(self, refs: str, source: Expression): ...
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user