PY-76629: [python] moved bundled django-stubs to helpers-pro package

GitOrigin-RevId: 24543c7c6249bd7ae8eac0cb6140754b5126858c
This commit is contained in:
Aleksei Kniazev
2024-08-13 17:39:45 +02:00
committed by intellij-monorepo-bot
parent f985a175df
commit 732cd5275a
682 changed files with 0 additions and 24758 deletions

View File

@@ -1,8 +0,0 @@
from typing import Literal
from .utils.version import get_version as get_version
VERSION: tuple[int, int, int, Literal["alpha", "beta", "rc", "final"], int]
__version__: str
def setup(set_prefix: bool = ...) -> None: ...

View File

@@ -1,2 +0,0 @@
from .config import AppConfig as AppConfig
from .registry import apps as apps

View File

@@ -1,30 +0,0 @@
import types
from collections.abc import Iterator
from django.apps.registry import Apps
from django.db.models.base import Model
from django.utils.functional import _Getter, _StrOrPromise
APPS_MODULE_NAME: str
MODELS_MODULE_NAME: str
class AppConfig:
name: str
module: types.ModuleType | None
apps: Apps | None
label: str
verbose_name: _StrOrPromise
path: str
models_module: types.ModuleType | None
# Default auto_field is a cached_property on the base, but is usually subclassed as a str
# If not subclassing with a str, a type ignore[override] is needed
models: dict[str, type[Model]]
default: bool
default_auto_field: str | _Getter[str]
def __init__(self, app_name: str, app_module: types.ModuleType | None) -> None: ...
@classmethod
def create(cls, entry: str) -> AppConfig: ...
def get_model(self, model_name: str, require_ready: bool = ...) -> type[Model]: ...
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> Iterator[type[Model]]: ...
def import_models(self) -> None: ...
def ready(self) -> None: ...

View File

@@ -1,41 +0,0 @@
import threading
from collections.abc import Callable, Iterable
from typing import Any
from django.db.models.base import Model
from .config import AppConfig
class Apps:
all_models: dict[str, dict[str, type[Model]]]
app_configs: dict[str, AppConfig]
stored_app_configs: list[Any]
apps_ready: bool
ready_event: threading.Event
loading: bool
_pending_operations: dict[tuple[str, str], list]
models_ready: bool
ready: bool
def __init__(self, installed_apps: Iterable[AppConfig | str] | None = ...) -> None: ...
def populate(self, installed_apps: Iterable[AppConfig | str] | None = ...) -> None: ...
def check_apps_ready(self) -> None: ...
def check_models_ready(self) -> None: ...
def get_app_configs(self) -> Iterable[AppConfig]: ...
def get_app_config(self, app_label: str) -> AppConfig: ...
# it's not possible to support it in plugin properly now
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> list[type[Model]]: ...
def get_model(self, app_label: str, model_name: str | None = ..., require_ready: bool = ...) -> type[Any]: ...
def register_model(self, app_label: str, model: type[Model]) -> None: ...
def is_installed(self, app_name: str) -> bool: ...
def get_containing_app_config(self, object_name: str) -> AppConfig | None: ...
def get_registered_model(self, app_label: str, model_name: str) -> type[Model]: ...
def get_swappable_settings_name(self, to_string: str) -> str | None: ...
def set_available_apps(self, available: Iterable[str]) -> None: ...
def unset_available_apps(self) -> None: ...
def set_installed_apps(self, installed: Iterable[str]) -> None: ...
def unset_installed_apps(self) -> None: ...
def clear_cache(self) -> None: ...
def lazy_model_operation(self, function: Callable, *model_keys: Any) -> None: ...
def do_pending_operations(self, model: type[Model]) -> None: ...
apps: Apps

View File

@@ -1,44 +0,0 @@
from typing import Any, Literal, type_check_only
from django.utils.functional import LazyObject
from typing_extensions import Self
# explicit dependency on standard settings to make it loaded
from . import global_settings # noqa: F401
ENVIRONMENT_VARIABLE: Literal["DJANGO_SETTINGS_MODULE"]
DEFAULT_STORAGE_ALIAS: Literal["default"]
STATICFILES_STORAGE_ALIAS: Literal["staticfiles"]
# RemovedInDjango60Warning.
FORMS_URLFIELD_ASSUME_HTTPS_DEPRECATED_MSG: str
# required for plugin to be able to distinguish this specific instance of LazySettings from others
@type_check_only
class _DjangoConfLazyObject(LazyObject):
def __getattr__(self, item: Any) -> Any: ...
class LazySettings(_DjangoConfLazyObject):
SETTINGS_MODULE: str
@property
def configured(self) -> bool: ...
def configure(self, default_settings: Any = ..., **options: Any) -> None: ...
settings: LazySettings
class Settings:
SETTINGS_MODULE: str
def __init__(self, settings_module: str) -> None: ...
def is_overridden(self, setting: str) -> bool: ...
class UserSettingsHolder:
SETTINGS_MODULE: None
def __init__(self, default_settings: Any) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...
def __delattr__(self, name: str) -> None: ...
def is_overridden(self, setting: str) -> bool: ...
class SettingsReference(str):
def __new__(self, value: Any, setting_name: str) -> Self: ...
def __init__(self, value: str, setting_name: str) -> None: ...

View File

@@ -1,525 +0,0 @@
from collections.abc import Sequence
from re import Pattern
# 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, Literal, Protocol, type_check_only
from typing_extensions import TypeAlias
_Admins: TypeAlias = list[tuple[str, str]]
####################
# CORE #
####################
DEBUG: bool
# Whether the framework should propagate raw exceptions rather than catching
# them. This is useful under some testing situations and should never be used
# on a live site.
DEBUG_PROPAGATE_EXCEPTIONS: bool
# People who get code error notifications.
# In the format [('Full Name', 'email@example.com'), ('Full Name', 'anotheremail@example.com')]
ADMINS: _Admins
# 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: int | None
LANGUAGE_COOKIE_DOMAIN: str | None
LANGUAGE_COOKIE_PATH: str
LANGUAGE_COOKIE_HTTPONLY: bool
LANGUAGE_COOKIE_SAMESITE: Literal["Lax", "Strict", "None", False] | None
LANGUAGE_COOKIE_SECURE: bool
# Not-necessarily-technical managers of the site. They get broken link
# notifications and other various emails.
MANAGERS: _Admins
# Default 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_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.
@type_check_only
class Router(Protocol):
def allow_migrate(self, db: str, app_label: str, **hints: Any) -> bool | None: ...
DATABASE_ROUTERS: list[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: str | None
EMAIL_SSL_KEYFILE: str | None
EMAIL_TIMEOUT: int | None
# List of strings representing installed apps.
INSTALLED_APPS: list[str]
TEMPLATES: list[dict[str, Any]]
# Default form rendering class.
FORM_RENDERER: str
# RemovedInDjango60Warning: It's a transitional setting helpful in early
# adoption of "https" as the new default value of forms.URLField.assume_scheme.
# Set to True to assume "https" during the Django 5.x release cycle.
FORMS_URLFIELD_ASSUME_HTTPS: bool
# 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: str | 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[str]]
ABSOLUTE_URL_OVERRIDES: dict[str, Any]
# List of compiled regular expression objects representing URLs that need not
# be reported by BrokenLinkEmailsMiddleware. Here are a few examples:
# import re
# IGNORABLE_404_URLS = [
# re.compile(r'^/apple-touch-icon.*\.png$'),
# re.compile(r'^/favicon.ico$'),
# re.compile(r'^/robots.txt$'),
# re.compile(r'^/phpmyadmin/'),
# re.compile(r'\.(cgi|php|pl)$'),
# ]
IGNORABLE_404_URLS: list[Pattern[str]]
# 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 | bytes
# A list of fallback secret keys for a particular Django installation. These
# are used to allow rotation of the SECRET_KEY.
SECRET_KEY_FALLBACKS: list[str | bytes]
# Default file storage mechanism that holds media.
DEFAULT_FILE_STORAGE: str
STORAGES: dict[str, dict[str, Any]]
# 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: str | None
# URL that handles the static files served from STATIC_ROOT.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL: str | None
# 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
# Maximum number of files encoded in a multipart upload that will be read
# before a SuspiciousOperation (TooManyFilesSent) is raised.
DATA_UPLOAD_MAX_NUMBER_FILES: 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: str | None
# 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: int
# 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: int | 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: str | None
# 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 primary key field type.
DEFAULT_AUTO_FIELD: 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: str | None
# 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: tuple[str, str] | None
##############
# 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: str
# Cookie name. This can be whatever you want.
SESSION_COOKIE_NAME: str
# Age of cookie, in seconds (default: 2 weeks).
SESSION_COOKIE_AGE: int
# A string like "example.com", or None for standard domain cookie.
SESSION_COOKIE_DOMAIN: str | None
# Whether the session cookie should be secure (https:// only).
SESSION_COOKIE_SECURE: bool
# The path of the session cookie.
SESSION_COOKIE_PATH: str
# Whether to use the non-RFC standard httpOnly flag (IE, FF3+, others)
SESSION_COOKIE_HTTPONLY: bool
# Whether to set the flag restricting cookie leaks on cross-site requests.
# This can be 'Lax', 'Strict', 'None', or False to disable the flag.
SESSION_COOKIE_SAMESITE: Literal["Lax", "Strict", "None", False]
# Whether to save the session data on every request.
SESSION_SAVE_EVERY_REQUEST: bool
# Whether a user's session cookie expires when the Web browser is closed.
SESSION_EXPIRE_AT_BROWSER_CLOSE: bool
# The module to store session data
SESSION_ENGINE: str
# Directory to store session files if using the file session module. If None,
# the backend will use a sensible default.
SESSION_FILE_PATH: str | None
# class to serialize session data
SESSION_SERIALIZER: str
#########
# CACHE #
#########
# The cache backends to use.
CACHES: dict[str, dict[str, Any]]
CACHE_MIDDLEWARE_KEY_PREFIX: str
CACHE_MIDDLEWARE_SECONDS: int
CACHE_MIDDLEWARE_ALIAS: str
##################
# AUTHENTICATION #
##################
AUTH_USER_MODEL: str
AUTHENTICATION_BACKENDS: Sequence[str]
LOGIN_URL: str
LOGIN_REDIRECT_URL: str
LOGOUT_REDIRECT_URL: str | None
# The number of seconds a password reset link is valid for
PASSWORD_RESET_TIMEOUT: int
# 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: str
########
# CSRF #
########
# Dotted path to callable to be used as view when a request is
# rejected by the CSRF middleware.
CSRF_FAILURE_VIEW: str
# Settings for CSRF cookie.
CSRF_COOKIE_NAME: str
CSRF_COOKIE_AGE: int
CSRF_COOKIE_DOMAIN: str | None
CSRF_COOKIE_PATH: str
CSRF_COOKIE_SECURE: bool
CSRF_COOKIE_HTTPONLY: bool
CSRF_COOKIE_SAMESITE: Literal["Lax", "Strict", "None", False]
CSRF_HEADER_NAME: str
CSRF_TRUSTED_ORIGINS: list[str]
CSRF_USE_SESSIONS: bool
############
# MESSAGES #
############
# Class to use as messages backend
MESSAGE_STORAGE: str
# 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: str
# Custom logging configuration.
LOGGING: dict[str, Any]
# Default exception reporter class used in case none has been
# specifically assigned to the HttpRequest instance.
DEFAULT_EXCEPTION_REPORTER: str
# Default exception reporter filter class used in case none has been
# specifically assigned to the HttpRequest instance.
DEFAULT_EXCEPTION_REPORTER_FILTER: str
###########
# TESTING #
###########
# The name of the class to use to run the test suite
TEST_RUNNER: str
# 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 | None]
#################
# 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_CONTENT_TYPE_NOSNIFF: bool
SECURE_CROSS_ORIGIN_OPENER_POLICY: str
SECURE_HSTS_INCLUDE_SUBDOMAINS: bool
SECURE_HSTS_PRELOAD: bool
SECURE_HSTS_SECONDS: int
SECURE_REDIRECT_EXEMPT: list[str]
SECURE_REFERRER_POLICY: str
SECURE_SSL_HOST: str | None
SECURE_SSL_REDIRECT: bool

View File

@@ -1,3 +0,0 @@
from typing import Any
LANG_INFO: dict[str, Any]

View File

@@ -1,32 +0,0 @@
# Stubs for django.conf.urls (Python 3.5)
from collections.abc import Callable, Sequence
from typing import Any, overload
from django.http.response import HttpResponse, HttpResponseBase
from django.urls import URLPattern, URLResolver
from django.urls import include as include
from typing_extensions import TypeAlias
handler400: str | Callable[..., HttpResponse]
handler403: str | Callable[..., HttpResponse]
handler404: str | Callable[..., HttpResponse]
handler500: str | Callable[..., HttpResponse]
_IncludedURLConf: TypeAlias = tuple[Sequence[URLResolver | URLPattern], str | None, str | None]
# Deprecated
@overload
def url(
regex: str, view: Callable[..., HttpResponseBase], kwargs: dict[str, Any] | None = ..., name: str | None = ...
) -> URLPattern: ...
@overload
def url(
regex: str, view: _IncludedURLConf, kwargs: dict[str, Any] | None = ..., name: str | None = ...
) -> URLResolver: ...
@overload
def url(
regex: str,
view: Sequence[URLResolver | str],
kwargs: dict[str, Any] | None = ...,
name: str | None = ...,
) -> URLResolver: ...

View File

@@ -1,6 +0,0 @@
from django.urls import _AnyURL
def i18n_patterns(*urls: _AnyURL, prefix_default_language: bool = ...) -> list[_AnyURL]: ...
def is_language_prefix_patterns_used(urlconf: str) -> tuple[bool, bool]: ...
urlpatterns: list[_AnyURL]

View File

@@ -1,6 +0,0 @@
from collections.abc import Callable
from typing import Any
from django.urls.resolvers import URLPattern
def static(prefix: str, view: Callable = ..., **kwargs: Any) -> list[URLPattern]: ...

View File

@@ -1,24 +0,0 @@
from . import checks as checks
from .decorators import action as action
from .decorators import display as display
from .decorators import register as register
from .filters import AllValuesFieldListFilter as AllValuesFieldListFilter
from .filters import BooleanFieldListFilter as BooleanFieldListFilter
from .filters import ChoicesFieldListFilter as ChoicesFieldListFilter
from .filters import DateFieldListFilter as DateFieldListFilter
from .filters import EmptyFieldListFilter as EmptyFieldListFilter
from .filters import FieldListFilter as FieldListFilter
from .filters import ListFilter as ListFilter
from .filters import RelatedFieldListFilter as RelatedFieldListFilter
from .filters import RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter
from .filters import SimpleListFilter as SimpleListFilter
from .options import HORIZONTAL as HORIZONTAL
from .options import VERTICAL as VERTICAL
from .options import ModelAdmin as ModelAdmin
from .options import ShowFacets as ShowFacets
from .options import StackedInline as StackedInline
from .options import TabularInline as TabularInline
from .sites import AdminSite as AdminSite
from .sites import site as site
def autodiscover() -> None: ...

View File

@@ -1,6 +0,0 @@
from django.contrib.admin.options import ModelAdmin
from django.db.models.query import QuerySet
from django.http.request import HttpRequest
from django.template.response import TemplateResponse
def delete_selected(modeladmin: ModelAdmin, request: HttpRequest, queryset: QuerySet) -> TemplateResponse | None: ...

View File

@@ -1,6 +0,0 @@
from django.apps import AppConfig
class SimpleAdminConfig(AppConfig):
default_site: str
class AdminConfig(SimpleAdminConfig): ...

View File

@@ -1,22 +0,0 @@
from collections.abc import Sequence
from typing import Any
from django.apps.config import AppConfig
from django.contrib.admin.options import BaseModelAdmin
from django.core.checks.messages import CheckMessage
def check_admin_app(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
def check_dependencies(**kwargs: Any) -> list[CheckMessage]: ...
class BaseModelAdminChecks:
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ...
class ModelAdminChecks(BaseModelAdminChecks):
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ...
class InlineModelAdminChecks(BaseModelAdminChecks):
def check(self, inline_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... # type: ignore[override]
def must_be(type: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ...
def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ...
def refer_to_missing_field(field: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ...

View File

@@ -1,43 +0,0 @@
from collections.abc import Callable, Sequence
from typing import Any, TypeVar, overload
from django.contrib.admin import ModelAdmin
from django.contrib.admin.sites import AdminSite
from django.db.models.base import Model
from django.db.models.expressions import BaseExpression, Combinable
from django.utils.functional import _StrOrPromise
_ModelAdmin = TypeVar("_ModelAdmin", bound=ModelAdmin[Any])
_F = TypeVar("_F", bound=Callable[..., Any])
@overload
def action(
function: _F,
permissions: Sequence[str] | None = ...,
description: _StrOrPromise | None = ...,
) -> _F: ...
@overload
def action(
*,
permissions: Sequence[str] | None = ...,
description: _StrOrPromise | None = ...,
) -> Callable[[_F], _F]: ...
@overload
def display(
function: _F,
boolean: bool | None = ...,
ordering: str | Combinable | BaseExpression | None = ...,
description: _StrOrPromise | None = ...,
empty_value: str | None = ...,
) -> _F: ...
@overload
def display(
*,
boolean: bool | None = ...,
ordering: str | Combinable | BaseExpression | None = ...,
description: _StrOrPromise | None = ...,
empty_value: str | None = ...,
) -> Callable[[_F], _F]: ...
def register(
*models: type[Model], site: AdminSite | None = ...
) -> Callable[[type[_ModelAdmin]], type[_ModelAdmin]]: ...

View File

@@ -1,6 +0,0 @@
from django.core.exceptions import SuspiciousOperation
class DisallowedModelAdminLookup(SuspiciousOperation): ...
class DisallowedModelAdminToField(SuspiciousOperation): ...
class AlreadyRegistered(Exception): ...
class NotRegistered(Exception): ...

View File

@@ -1,126 +0,0 @@
from collections.abc import Callable, Iterable, Iterator
from datetime import date, datetime
from typing import Any, ClassVar
from django.contrib.admin.options import ModelAdmin
from django.contrib.admin.views.main import ChangeList
from django.db.models.aggregates import Count
from django.db.models.base import Model
from django.db.models.fields import Field
from django.db.models.fields.related import RelatedField
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
from django.http.request import HttpRequest
from django.utils.datastructures import _ListOrTuple
from django.utils.functional import _StrOrPromise
from django.utils.safestring import SafeString
from typing_extensions import TypedDict
class _ListFilterChoices(TypedDict):
selected: bool
query_string: str
display: _StrOrPromise
class ListFilter:
title: _StrOrPromise | None
template: str
request: HttpRequest
used_parameters: dict[str, bool | datetime | str]
def __init__(
self, request: HttpRequest, params: dict[str, str], model: type[Model], model_admin: ModelAdmin
) -> None: ...
def has_output(self) -> bool: ...
def choices(self, changelist: ChangeList) -> Iterator[_ListFilterChoices]: ...
def queryset(self, request: HttpRequest, queryset: QuerySet) -> QuerySet | None: ...
def expected_parameters(self) -> list[str | None]: ...
class FacetsMixin:
def get_facet_counts(self, pk_attname: str, filtered_qs: QuerySet[Model]) -> dict[str, Count]: ...
def get_facet_queryset(self, changelist: ChangeList) -> dict[str, int]: ...
class SimpleListFilter(FacetsMixin, ListFilter):
parameter_name: str | None
lookup_choices: list[tuple[str, _StrOrPromise]]
def value(self) -> str | None: ...
def lookups(self, request: HttpRequest, model_admin: ModelAdmin) -> Iterable[tuple[str, _StrOrPromise]] | None: ...
class FieldListFilter(FacetsMixin, ListFilter):
list_separator: ClassVar[str]
field: Field
field_path: str
title: _StrOrPromise
def __init__(
self,
field: Field,
request: HttpRequest,
params: dict[str, str],
model: type[Model],
model_admin: ModelAdmin,
field_path: str,
) -> None: ...
@classmethod
def register(
cls, test: Callable[[Field], Any], list_filter_class: type[FieldListFilter], take_priority: bool = ...
) -> None: ...
@classmethod
def create(
cls,
field: Field,
request: HttpRequest,
params: dict[str, str],
model: type[Model],
model_admin: ModelAdmin,
field_path: str,
) -> FieldListFilter: ...
class RelatedFieldListFilter(FieldListFilter):
lookup_kwarg: str
lookup_kwarg_isnull: str
lookup_val: str | None
lookup_val_isnull: str | None
lookup_choices: list[tuple[str, _StrOrPromise]]
lookup_title: _StrOrPromise
empty_value_display: SafeString
@property
def include_empty_choice(self) -> bool: ...
def field_admin_ordering(
self, field: RelatedField, request: HttpRequest, model_admin: ModelAdmin
) -> _ListOrTuple[str]: ...
def field_choices(
self, field: RelatedField, request: HttpRequest, model_admin: ModelAdmin
) -> list[tuple[str, _StrOrPromise]]: ...
class BooleanFieldListFilter(FieldListFilter):
lookup_kwarg: str
lookup_kwarg2: str
lookup_val: str | None
lookup_val2: str | None
class ChoicesFieldListFilter(FieldListFilter):
lookup_kwarg: str
lookup_kwarg_isnull: str
lookup_val: str | None
lookup_val_isnull: str | None
class DateFieldListFilter(FieldListFilter):
field_generic: str
date_params: dict[str, str]
lookup_kwarg_since: str
lookup_kwarg_until: str
links: tuple[tuple[_StrOrPromise, dict[str, bool | date | datetime]], ...]
lookup_kwarg_isnull: str
class AllValuesFieldListFilter(FieldListFilter):
lookup_kwarg: str
lookup_kwarg_isnull: str
lookup_val: str | None
lookup_val_isnull: str | None
empty_value_display: SafeString
lookup_choices: QuerySet
class RelatedOnlyFieldListFilter(RelatedFieldListFilter): ...
class EmptyFieldListFilter(FieldListFilter):
lookup_kwarg: str
lookup_val: str | None
def get_lookup_condition(self) -> Q: ...

View File

@@ -1,7 +0,0 @@
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
class AdminAuthenticationForm(AuthenticationForm):
required_css_class: str
class AdminPasswordChangeForm(PasswordChangeForm):
required_css_class: str

View File

@@ -1,181 +0,0 @@
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from typing import Any, type_check_only
from django import forms
from django.contrib.admin.options import ModelAdmin
from django.db.models import Model
from django.db.models.fields import AutoField
from django.forms import BaseForm
from django.forms.boundfield import BoundField
from django.forms.models import ModelForm
from django.forms.utils import ErrorDict, ErrorList
from django.forms.widgets import Media, Widget
from django.utils.safestring import SafeString
from typing_extensions import TypedDict
ACTION_CHECKBOX_NAME: str
class ActionForm(forms.Form):
action: Any
select_across: Any
@type_check_only
class _PrepopulatedDict(TypedDict):
field: BoundField
dependencies: list[BoundField]
class AdminForm:
prepopulated_fields: list[_PrepopulatedDict]
model_admin: ModelAdmin | None
readonly_fields: Sequence[str]
form: ModelForm
fieldsets: list[tuple[Any, dict[str, list[str]]]]
def __init__(
self,
form: ModelForm,
fieldsets: list[tuple[Any, dict[str, list[str]]]],
prepopulated_fields: Mapping[str, Iterable[str]],
readonly_fields: Sequence[str] | None = ...,
model_admin: ModelAdmin | None = ...,
) -> None: ...
def __iter__(self) -> Iterator[Fieldset]: ...
@property
def errors(self) -> ErrorDict: ...
@property
def non_field_errors(self) -> Callable[[], ErrorList]: ...
@property
def media(self) -> Media: ...
class Fieldset:
form: ModelForm
classes: str
description: str | None
model_admin: ModelAdmin | None
readonly_fields: Sequence[str]
def __init__(
self,
form: ModelForm,
name: Any | None = ...,
readonly_fields: Sequence[str] = ...,
fields: Sequence[str] = ...,
classes: Iterable[str] = ...,
description: str | None = ...,
model_admin: ModelAdmin | None = ...,
) -> None: ...
@property
def media(self) -> Media: ...
def __iter__(self) -> Iterator[Fieldline]: ...
class Fieldline:
form: ModelForm
fields: Sequence[str]
has_visible_field: bool
model_admin: ModelAdmin | None
readonly_fields: Sequence[str]
def __init__(
self,
form: ModelForm,
field: str | Sequence[str],
readonly_fields: Sequence[str] | None = ...,
model_admin: ModelAdmin | None = ...,
) -> None: ...
def __iter__(self) -> Iterator[AdminField | AdminReadonlyField]: ...
def errors(self) -> SafeString: ...
class AdminField:
field: BoundField
is_first: bool
is_checkbox: bool
is_readonly: bool
def __init__(self, form: ModelForm, field: str, is_first: bool) -> None: ...
def label_tag(self) -> SafeString: ...
def errors(self) -> SafeString: ...
@type_check_only
class _FieldDictT(TypedDict):
name: str
label: str
help_text: str
field: Callable[[Model], Any] | str
class AdminReadonlyField:
field: _FieldDictT
form: ModelForm
model_admin: ModelAdmin | None
is_first: bool
is_checkbox: bool
is_readonly: bool
empty_value_display: Any
def __init__(
self,
form: ModelForm,
field: Callable[[Model], Any] | str,
is_first: bool,
model_admin: ModelAdmin | None = ...,
) -> None: ...
def label_tag(self) -> SafeString: ...
def contents(self) -> SafeString: ...
class InlineAdminFormSet:
opts: Any
formset: Any
fieldsets: Any
model_admin: ModelAdmin | None
readonly_fields: Sequence[str]
prepopulated_fields: dict[str, Any]
classes: str
has_add_permission: bool
has_change_permission: bool
has_delete_permission: bool
has_view_permission: bool
def __init__(
self,
inline: Any,
formset: Any,
fieldsets: Any,
prepopulated_fields: dict[str, Any] | None = ...,
readonly_fields: Sequence[str] | None = ...,
model_admin: ModelAdmin | None = ...,
has_add_permission: bool = ...,
has_change_permission: bool = ...,
has_delete_permission: bool = ...,
has_view_permission: bool = ...,
) -> None: ...
def __iter__(self) -> Iterator[InlineAdminForm]: ...
def fields(self) -> Iterator[dict[str, dict[str, bool] | bool | Widget | str]]: ...
def inline_formset_data(self) -> str: ...
@property
def forms(self) -> list[BaseForm]: ...
def non_form_errors(self) -> ErrorList: ...
@property
def media(self) -> Media: ...
class InlineAdminForm(AdminForm):
formset: Any
original: bool | None
show_url: bool
absolute_url: str | None
def __init__(
self,
formset: Any,
form: ModelForm,
fieldsets: Any,
prepopulated_fields: Any,
original: bool | None,
readonly_fields: Sequence[str] | None = ...,
model_admin: ModelAdmin | None = ...,
view_on_site_url: str | None = ...,
) -> None: ...
def __iter__(self) -> Iterator[InlineFieldset]: ...
def needs_explicit_pk_field(self) -> bool | AutoField: ...
def pk_field(self) -> AdminField: ...
def fk_field(self) -> AdminField: ...
def deletion_field(self) -> AdminField: ...
class InlineFieldset(Fieldset):
formset: Any
def __init__(self, formset: Any, *args: Any, **kwargs: Any) -> None: ...
def __iter__(self) -> Iterator[Fieldline]: ...
class AdminErrorList(forms.utils.ErrorList):
def __init__(self, form: ModelForm, inline_formsets: Any) -> None: ...

View File

@@ -1,37 +0,0 @@
from typing import Any, ClassVar
from uuid import UUID
from django.db import models
from django.db.models.base import Model
ADDITION: int
CHANGE: int
DELETION: int
ACTION_FLAG_CHOICES: Any
class LogEntryManager(models.Manager[LogEntry]):
def log_action(
self,
user_id: int,
content_type_id: int,
object_id: int | str | UUID,
object_repr: str,
action_flag: int,
change_message: Any = ...,
) -> LogEntry: ...
class LogEntry(models.Model):
action_time: models.DateTimeField
user: models.ForeignKey
content_type: models.ForeignKey
object_id: models.TextField
object_repr: models.CharField
action_flag: models.PositiveSmallIntegerField
change_message: models.TextField
objects: ClassVar[LogEntryManager]
def is_addition(self) -> bool: ...
def is_change(self) -> bool: ...
def is_deletion(self) -> bool: ...
def get_change_message(self) -> str: ...
def get_edited_object(self) -> Model: ...
def get_admin_url(self) -> str | None: ...

View File

@@ -1,329 +0,0 @@
import enum
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from typing import Any, Generic, Literal, TypeVar, type_check_only
from django import forms
from django.contrib.admin.filters import FieldListFilter, 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 CheckMessage
from django.core.paginator import Paginator
from django.db.models.base import Model
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 Field as FormField
from django.forms.fields import TypedChoiceField
from django.forms.formsets import BaseFormSet
from django.forms.models import (
BaseInlineFormSet,
BaseModelFormSet,
ModelChoiceField,
ModelForm,
ModelMultipleChoiceField,
)
from django.forms.widgets import Media
from django.http.request import HttpRequest
from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect
from django.template.response import _TemplateForResponseT
from django.urls.resolvers import URLPattern
from django.utils.datastructures import _ListOrTuple
from django.utils.functional import _StrOrPromise
from django.utils.safestring import SafeString
from typing_extensions import Self, TypeAlias, TypedDict
IS_POPUP_VAR: str
TO_FIELD_VAR: str
IS_FACETS_VAR: str
HORIZONTAL: Literal[1]
VERTICAL: Literal[2]
_Direction: TypeAlias = Literal[1, 2]
class ShowFacets(enum.Enum):
NEVER: str
ALLOW: str
ALWAYS: str
def get_content_type_for_model(obj: type[Model] | Model) -> ContentType: ...
def get_ul_class(radio_style: int) -> str: ...
class IncorrectLookupParameters(Exception): ...
FORMFIELD_FOR_DBFIELD_DEFAULTS: Any
csrf_protect_m: Any
_FieldGroups: TypeAlias = Sequence[str | Sequence[str]]
@type_check_only
class _OptionalFieldOpts(TypedDict, total=False):
classes: Sequence[str]
description: _StrOrPromise
@type_check_only
class _FieldOpts(_OptionalFieldOpts, total=True):
fields: _FieldGroups
# Workaround for mypy issue, a Sequence type should be preferred here.
# https://github.com/python/mypy/issues/8921
# _FieldsetSpec = Sequence[Tuple[Optional[str], _FieldOpts]]
_FieldsetSpec: TypeAlias = _ListOrTuple[tuple[_StrOrPromise | None, _FieldOpts]]
_ListFilterT: TypeAlias = (
type[ListFilter]
| Field[Any, Any]
| str
| tuple[Field[Any, Any] | str, type[FieldListFilter]]
| list[Field[Any, Any] | str | type[FieldListFilter]]
)
# Generic type specifically for models, for use in BaseModelAdmin and subclasses
# https://github.com/typeddjango/django-stubs/issues/482
_ModelT = TypeVar("_ModelT", bound=Model)
_DisplayT: TypeAlias = _ListOrTuple[str | Callable[[_ModelT], str | bool]]
class BaseModelAdmin(Generic[_ModelT]):
autocomplete_fields: _ListOrTuple[str]
raw_id_fields: _ListOrTuple[str]
fields: _FieldGroups | None
exclude: _ListOrTuple[str] | None
fieldsets: _FieldsetSpec | None
form: type[forms.ModelForm[_ModelT]]
filter_vertical: _ListOrTuple[str]
filter_horizontal: _ListOrTuple[str]
radio_fields: Mapping[str, _Direction]
prepopulated_fields: dict[str, Sequence[str]]
formfield_overrides: Mapping[type[Field], Mapping[str, Any]]
readonly_fields: _ListOrTuple[str]
ordering: _ListOrTuple[str] | None
sortable_by: _ListOrTuple[str] | None
show_full_result_count: bool
checks_class: Any
model: type[_ModelT]
opts: Options[_ModelT]
admin_site: AdminSite
def __init__(self) -> None: ...
def check(self, **kwargs: Any) -> list[CheckMessage]: ...
def formfield_for_dbfield(self, db_field: Field, request: HttpRequest, **kwargs: Any) -> FormField: ...
def formfield_for_choice_field(self, db_field: Field, request: HttpRequest, **kwargs: Any) -> TypedChoiceField: ...
def get_field_queryset(self, db: str | None, db_field: RelatedField, request: HttpRequest) -> QuerySet | None: ...
def formfield_for_foreignkey(
self, db_field: ForeignKey, request: HttpRequest, **kwargs: Any
) -> ModelChoiceField: ...
def formfield_for_manytomany(
self, db_field: ManyToManyField, request: HttpRequest, **kwargs: Any
) -> ModelMultipleChoiceField | None: ...
def get_autocomplete_fields(self, request: HttpRequest) -> _ListOrTuple[str]: ...
def get_view_on_site_url(self, obj: _ModelT | None = ...) -> str | None: ...
def get_empty_value_display(self) -> SafeString: ...
def get_exclude(self, request: HttpRequest, obj: _ModelT | None = ...) -> _ListOrTuple[str] | None: ...
def get_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> _FieldGroups: ...
def get_fieldsets(self, request: HttpRequest, obj: _ModelT | None = ...) -> _FieldsetSpec: ...
def get_inlines(self, request: HttpRequest, obj: _ModelT | None) -> list[type[InlineModelAdmin]]: ...
def get_ordering(self, request: HttpRequest) -> _ListOrTuple[str]: ...
def get_readonly_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> _ListOrTuple[str]: ...
def get_prepopulated_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> dict[str, Sequence[str]]: ...
def get_queryset(self, request: HttpRequest) -> QuerySet[_ModelT]: ...
def get_sortable_by(self, request: HttpRequest) -> _DisplayT[_ModelT]: ...
def lookup_allowed(self, lookup: str, value: str, request: HttpRequest | None = ...) -> bool: ...
def to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ...
def has_add_permission(self, request: HttpRequest) -> bool: ...
def has_change_permission(self, request: HttpRequest, obj: _ModelT | None = ...) -> bool: ...
def has_delete_permission(self, request: HttpRequest, obj: _ModelT | None = ...) -> bool: ...
def has_view_permission(self, request: HttpRequest, obj: _ModelT | None = ...) -> bool: ...
def has_view_or_change_permission(self, request: HttpRequest, obj: _ModelT | None = ...) -> bool: ...
def has_module_permission(self, request: HttpRequest) -> bool: ...
@property
def view_on_site(self) -> Callable[[_ModelT], str] | bool: ...
_ModelAdmin = TypeVar("_ModelAdmin", bound=ModelAdmin[Any])
_ActionCallable: TypeAlias = Callable[[_ModelAdmin, HttpRequest, QuerySet[_ModelT]], HttpResponseBase | None]
class ModelAdmin(BaseModelAdmin[_ModelT]):
list_display: _DisplayT[_ModelT]
list_display_links: _DisplayT[_ModelT] | None
list_filter: _ListOrTuple[_ListFilterT]
list_select_related: bool | _ListOrTuple[str]
list_per_page: int
list_max_show_all: int
list_editable: _ListOrTuple[str]
search_fields: _ListOrTuple[str]
search_help_text: _StrOrPromise | None
date_hierarchy: str | None
save_as: bool
save_as_continue: bool
save_on_top: bool
paginator: type
preserve_filters: bool
show_facets: ShowFacets
inlines: _ListOrTuple[type[InlineModelAdmin]]
add_form_template: _TemplateForResponseT | None
change_form_template: _TemplateForResponseT | None
change_list_template: _TemplateForResponseT | None
delete_confirmation_template: _TemplateForResponseT | None
delete_selected_confirmation_template: _TemplateForResponseT | None
object_history_template: _TemplateForResponseT | None
popup_response_template: _TemplateForResponseT | None
actions: Sequence[_ActionCallable[Self, _ModelT] | str] | None
action_form: Any
actions_on_top: bool
actions_on_bottom: bool
actions_selection_counter: bool
model: type[_ModelT]
opts: Options[_ModelT]
admin_site: AdminSite
def __init__(self, model: type[_ModelT], admin_site: AdminSite) -> None: ...
def get_inline_instances(self, request: HttpRequest, obj: _ModelT | None = ...) -> 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: HttpRequest) -> dict[str, bool]: ...
def get_form(
self, request: HttpRequest, obj: _ModelT | None = ..., change: bool = ..., **kwargs: Any
) -> type[forms.ModelForm[_ModelT]]: ...
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: str | None = ...) -> _ModelT | None: ...
def get_changelist_form(self, request: HttpRequest, **kwargs: Any) -> type[ModelForm[_ModelT]]: ...
def get_changelist_formset(
self, request: HttpRequest, **kwargs: Any
) -> type[BaseModelFormSet[_ModelT, ModelForm[_ModelT]]]: ...
def get_formsets_with_inlines(self, request: HttpRequest, obj: _ModelT | None = ...) -> Iterator[Any]: ...
def get_paginator(
self,
request: HttpRequest,
queryset: QuerySet,
per_page: int,
orphans: int = ...,
allow_empty_first_page: bool = ...,
) -> Paginator: ...
def log_addition(self, request: HttpRequest, object: _ModelT, message: Any) -> LogEntry: ...
def log_change(self, request: HttpRequest, object: _ModelT, message: Any) -> LogEntry: ...
def log_deletion(self, request: HttpRequest, object: _ModelT, object_repr: str) -> LogEntry: ...
def action_checkbox(self, obj: _ModelT) -> SafeString: ...
def get_actions(self, request: HttpRequest) -> dict[str, tuple[Callable[..., str], str, str] | None]: ...
def get_action_choices(
self, request: HttpRequest, default_choices: list[tuple[str, str]] = ...
) -> list[tuple[str, str]]: ...
def get_action(self, action: Callable | str) -> tuple[Callable[..., str], str, str] | None: ...
def get_list_display(self, request: HttpRequest) -> _DisplayT[_ModelT]: ...
def get_list_display_links(self, request: HttpRequest, list_display: _DisplayT[_ModelT]) -> _DisplayT[_ModelT]: ...
def get_list_filter(self, request: HttpRequest) -> _ListOrTuple[_ListFilterT]: ...
def get_list_select_related(self, request: HttpRequest) -> bool | _ListOrTuple[str]: ...
def get_search_fields(self, request: HttpRequest) -> _ListOrTuple[str]: ...
def get_search_results(
self, request: HttpRequest, queryset: QuerySet, search_term: str
) -> tuple[QuerySet[_ModelT], bool]: ...
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[_ModelT]: ...
def construct_change_message(
self, request: HttpRequest, form: AdminPasswordChangeForm, formsets: Iterable[BaseFormSet], add: bool = ...
) -> list[dict[str, dict[str, list[str]]]]: ...
def message_user(
self,
request: HttpRequest,
message: _StrOrPromise,
level: int | str = ...,
extra_tags: str = ...,
fail_silently: bool = ...,
) -> None: ...
def save_form(self, request: HttpRequest, form: Any, change: Any) -> Any: ...
def save_model(self, request: HttpRequest, obj: _ModelT, form: Any, change: Any) -> None: ...
def delete_model(self, request: HttpRequest, obj: _ModelT) -> None: ...
def delete_queryset(self, request: HttpRequest, queryset: QuerySet) -> None: ...
def save_formset(self, request: HttpRequest, form: Any, formset: Any, change: Any) -> None: ...
def save_related(self, request: HttpRequest, form: Any, formsets: Any, change: Any) -> None: ...
def render_change_form(
self,
request: HttpRequest,
context: dict[str, Any],
add: bool = ...,
change: bool = ...,
form_url: str = ...,
obj: _ModelT | None = ...,
) -> HttpResponse: ...
def response_add(self, request: HttpRequest, obj: _ModelT, post_url_continue: str | None = ...) -> HttpResponse: ...
def response_change(self, request: HttpRequest, obj: _ModelT) -> HttpResponse: ...
def response_post_save_add(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ...
def response_post_save_change(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ...
# Probably FileResponse cannot come from ModelAdmin views
def response_action(self, request: HttpRequest, queryset: QuerySet) -> HttpResponse | None: ...
def response_delete(self, request: HttpRequest, obj_display: str, obj_id: int) -> HttpResponse: ...
def render_delete_form(self, request: HttpRequest, context: dict[str, Any]) -> HttpResponse: ...
def get_inline_formsets(
self, request: HttpRequest, formsets: list[Any], inline_instances: list[Any], obj: _ModelT | None = ...
) -> list[Any]: ...
def get_changeform_initial_data(self, request: HttpRequest) -> dict[str, str | list[str]]: ...
def changeform_view(
self,
request: HttpRequest,
object_id: str | None = ...,
form_url: str = ...,
extra_context: dict[str, Any] | None = ...,
) -> HttpResponse: ...
def add_view(
self, request: HttpRequest, form_url: str = ..., extra_context: dict[str, Any] | None = ...
) -> HttpResponse: ...
def change_view(
self, request: HttpRequest, object_id: str, form_url: str = ..., extra_context: dict[str, Any] | None = ...
) -> HttpResponse: ...
def changelist_view(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> HttpResponse: ...
def get_deleted_objects(
self, objs: Sequence[_ModelT] | QuerySet[_ModelT], request: HttpRequest
) -> tuple[list[str], dict[str, int], set[str], list[str]]: ...
def delete_view(
self, request: HttpRequest, object_id: str, extra_context: dict[str, Any] | None = ...
) -> HttpResponse: ...
def history_view(
self, request: HttpRequest, object_id: str, extra_context: dict[str, Any] | None = ...
) -> HttpResponse: ...
def get_formset_kwargs(
self, request: HttpRequest, obj: _ModelT, inline: InlineModelAdmin[Any, _ModelT], prefix: str
) -> dict[str, Any]: ...
_ChildModelT = TypeVar("_ChildModelT", bound=Model)
_ParentModelT = TypeVar("_ParentModelT", bound=Model)
class InlineModelAdmin(Generic[_ChildModelT, _ParentModelT], BaseModelAdmin[_ChildModelT]):
model: type[_ChildModelT]
fk_name: str | None
formset: type[BaseInlineFormSet[_ChildModelT, _ParentModelT, forms.ModelForm[_ChildModelT]]]
extra: int
min_num: int | None
max_num: int | None
template: str
verbose_name: _StrOrPromise | None
verbose_name_plural: _StrOrPromise | None
can_delete: bool
show_change_link: bool
classes: Sequence[str] | None
admin_site: AdminSite
parent_model: type[_ParentModelT]
opts: Options[_ChildModelT]
has_registered_model: bool
def __init__(self, parent_model: type[_ParentModelT], admin_site: AdminSite) -> None: ...
@property
def media(self) -> Media: ...
def get_extra(self, request: HttpRequest, obj: _ParentModelT | None = ..., **kwargs: Any) -> int: ...
def get_min_num(self, request: HttpRequest, obj: _ParentModelT | None = ..., **kwargs: Any) -> int | None: ...
def get_max_num(self, request: HttpRequest, obj: _ParentModelT | None = ..., **kwargs: Any) -> int | None: ...
def get_formset(
self, request: HttpRequest, obj: _ParentModelT | None = ..., **kwargs: Any
) -> type[BaseInlineFormSet[_ChildModelT, _ParentModelT, forms.ModelForm[_ChildModelT]]]: ...
def get_queryset(self, request: HttpRequest) -> QuerySet[_ChildModelT]: ...
def has_add_permission(self, request: HttpRequest, obj: _ParentModelT | None) -> bool: ... # type: ignore[override]
def has_change_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore[override]
def has_delete_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore[override]
def has_view_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore[override]
class StackedInline(InlineModelAdmin[_ChildModelT, _ParentModelT]):
template: str
class TabularInline(InlineModelAdmin[_ChildModelT, _ParentModelT]):
template: str

View File

@@ -1,93 +0,0 @@
import sys
from collections.abc import Callable, Iterable
from typing import Any, TypeVar
from django.apps.config import AppConfig
from django.contrib.admin.models import LogEntry
from django.contrib.admin.options import ModelAdmin
from django.contrib.auth.forms import AuthenticationForm
from django.core.checks import CheckMessage
from django.db.models.base import Model
from django.db.models.query import QuerySet
from django.http.request import HttpRequest
from django.http.response import HttpResponse, HttpResponseBase
from django.template.response import TemplateResponse
from django.urls import URLPattern, URLResolver
from django.utils.functional import LazyObject, _StrOrPromise
from typing_extensions import TypeAlias
if sys.version_info >= (3, 9):
from weakref import WeakSet
all_sites: WeakSet[AdminSite]
else:
from collections.abc import MutableSet
all_sites: MutableSet[AdminSite]
_ViewType = TypeVar("_ViewType", bound=Callable[..., HttpResponseBase])
_ModelT = TypeVar("_ModelT", bound=Model)
_ActionCallback: TypeAlias = Callable[[ModelAdmin, HttpRequest, QuerySet], TemplateResponse | None]
class AdminSite:
site_title: _StrOrPromise
site_header: _StrOrPromise
index_title: _StrOrPromise
site_url: str | None
login_form: type[AuthenticationForm] | None
index_template: str | None
app_index_template: str | None
login_template: str | None
logout_template: str | None
password_change_template: str | None
password_change_done_template: str | None
name: str
enable_nav_sidebar: bool
empty_value_display: str
final_catch_all_view: bool
_empty_value_display: str
_registry: dict[type[Model], ModelAdmin]
_global_actions: dict[str, _ActionCallback]
_actions: dict[str, _ActionCallback]
def __init__(self, name: str = ...) -> None: ...
def check(self, app_configs: Iterable[AppConfig] | None) -> list[CheckMessage]: ...
def register(
self,
model_or_iterable: type[Model] | Iterable[type[Model]],
admin_class: type[ModelAdmin] | None = ...,
**options: Any,
) -> None: ...
def unregister(self, model_or_iterable: type[Model] | Iterable[type[Model]]) -> None: ...
def is_registered(self, model: type[Model]) -> bool: ...
def get_model_admin(self, model: type[_ModelT]) -> ModelAdmin[_ModelT]: ...
def add_action(self, action: _ActionCallback, name: str | None = ...) -> None: ...
def disable_action(self, name: str) -> None: ...
def get_action(self, name: str) -> _ActionCallback: ...
@property
def actions(self) -> Iterable[tuple[str, _ActionCallback]]: ...
def has_permission(self, request: HttpRequest) -> bool: ...
def admin_view(self, view: _ViewType, cacheable: bool = ...) -> _ViewType: ...
def get_urls(self) -> list[URLResolver | URLPattern]: ...
@property
def urls(self) -> tuple[list[URLResolver | URLPattern], str, str]: ...
def each_context(self, request: HttpRequest) -> dict[str, Any]: ...
def password_change(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> TemplateResponse: ...
def password_change_done(
self, request: HttpRequest, extra_context: dict[str, Any] | None = ...
) -> TemplateResponse: ...
def i18n_javascript(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> HttpResponse: ...
def logout(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> TemplateResponse: ...
def login(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> HttpResponse: ...
def _build_app_dict(self, request: HttpRequest, label: _StrOrPromise | None = ...) -> dict[str, Any]: ...
def get_app_list(self, request: HttpRequest, app_label: str | None = ...) -> list[Any]: ...
def index(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> TemplateResponse: ...
def app_index(
self, request: HttpRequest, app_label: str, extra_context: dict[str, Any] | None = ...
) -> TemplateResponse: ...
def autocomplete_view(self, request: HttpRequest) -> HttpResponse: ...
def catch_all_view(self, request: HttpRequest, url: str) -> HttpResponse: ...
def get_log_entries(self, request: HttpRequest) -> QuerySet[LogEntry]: ...
class DefaultAdminSite(LazyObject): ...
site: AdminSite

View File

@@ -1,41 +0,0 @@
from collections.abc import Iterator
from typing import Any
from django.contrib.admin.filters import FieldListFilter
from django.contrib.admin.views.main import ChangeList
from django.db.models.base import Model
from django.forms.boundfield import BoundField
from django.forms.models import ModelForm
from django.template.base import Parser, Token
from django.template.context import RequestContext
from django.utils.safestring import SafeString
from .base import InclusionAdminNode
register: Any
DOT: str
def paginator_number(cl: ChangeList, i: int) -> SafeString: ...
def pagination(cl: ChangeList) -> dict[str, Any]: ...
def pagination_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
def result_headers(cl: ChangeList) -> Iterator[dict[str, int | str | None]]: ...
def items_for_result(cl: ChangeList, result: Model, form: ModelForm | None) -> Iterator[SafeString]: ...
class ResultList(list):
form: ModelForm | None
def __init__(self, form: ModelForm | None, *items: Any) -> None: ...
def results(cl: ChangeList) -> Iterator[ResultList]: ...
def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ...
def result_list(
cl: ChangeList,
) -> dict[str, list[dict[str, int | str | None]] | list[ResultList] | list[BoundField] | ChangeList | int]: ...
def result_list_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
def date_hierarchy(cl: ChangeList) -> dict[str, Any] | None: ...
def date_hierarchy_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
def search_form(cl: ChangeList) -> dict[str, bool | ChangeList | str]: ...
def search_form_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
def admin_list_filter(cl: ChangeList, spec: FieldListFilter) -> SafeString: ...
def admin_actions(context: RequestContext) -> RequestContext: ...
def admin_actions_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
def change_list_object_tools_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...

View File

@@ -1,16 +0,0 @@
from typing import Any
from django.contrib.admin.helpers import InlineAdminForm
from django.template.base import Parser, Token
from django.template.context import Context, RequestContext
from .base import InclusionAdminNode
register: Any
def prepopulated_fields_js(context: RequestContext) -> RequestContext: ...
def prepopulated_fields_js_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
def submit_row(context: RequestContext) -> Context: ...
def submit_row_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
def change_form_object_tools_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
def cell_count(inline_admin_form: InlineAdminForm) -> int: ...

View File

@@ -1,17 +0,0 @@
from typing import Any
from uuid import UUID
from django.db.models.options import Options
from django.template.context import RequestContext
from django.utils.safestring import SafeString
register: Any
def admin_urlname(value: Options, arg: SafeString) -> str: ...
def admin_urlquote(value: int | str | UUID) -> int | str | UUID: ...
def add_preserved_filters(
context: dict[str, Options | str] | RequestContext,
url: str,
popup: bool = ...,
to_field: str | None = ...,
) -> str: ...

View File

@@ -1,18 +0,0 @@
from collections.abc import Callable
from typing import Any
from django.template.base import Parser, Token
from django.template.context import Context
from django.template.library import InclusionNode
from django.utils.safestring import SafeString
class InclusionAdminNode(InclusionNode):
args: list[Any]
func: Callable
kwargs: dict[str, Any]
takes_context: bool
template_name: str
def __init__(
self, parser: Parser, token: Token, func: Callable, template_name: str, takes_context: bool = ...
) -> None: ...
def render(self, context: Context) -> SafeString: ...

View File

@@ -1,16 +0,0 @@
from typing import Any
from django import template
from django.template.base import Parser, Token
from django.template.context import Context
register: Any
class AdminLogNode(template.Node):
limit: str
user: str
varname: str
def __init__(self, limit: str, varname: str, user: str | None) -> None: ...
def render(self, context: Context) -> str: ...
def get_admin_log(parser: Parser, token: Token) -> AdminLogNode: ...

View File

@@ -1,27 +0,0 @@
from collections.abc import Callable, Generator
from contextlib import contextmanager
from typing import Any
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.test.selenium import SeleniumTestCase
from django.utils.deprecation import MiddlewareMixin
class CSPMiddleware(MiddlewareMixin): ...
class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase):
def wait_until(self, callback: Callable, timeout: int = ...) -> None: ...
def wait_for_and_switch_to_popup(self, num_windows: int = ..., timeout: int = ...) -> None: ...
def wait_for(self, css_selector: str, timeout: int = ...) -> None: ...
def wait_for_text(self, css_selector: str, text: str, timeout: int = ...) -> None: ...
def wait_for_value(self, css_selector: str, text: str, timeout: int = ...) -> None: ...
def wait_until_visible(self, css_selector: str, timeout: int = ...) -> None: ...
def wait_until_invisible(self, css_selector: str, timeout: int = ...) -> None: ...
def wait_page_ready(self, timeout: int = ...) -> None: ...
@contextmanager
def wait_page_loaded(self, timeout: int = ...) -> Generator[None, None, None]: ...
def admin_login(self, username: str, password: str, login_url: str = ...) -> None: ...
def select_option(self, selector: str, value: Any) -> None: ...
def deselect_option(self, selector: str, value: Any) -> None: ...
def assertSelectOptions(self, selector: str, values: Any) -> None: ...
def assertSelectedOptions(self, selector: str, values: Any) -> None: ...
def has_css_class(self, selector: str, klass: str) -> bool: ...

View File

@@ -1,104 +0,0 @@
import datetime
from collections import defaultdict
from collections.abc import Callable, Iterable, Sequence
from typing import Any, Literal, TypeVar, overload, type_check_only
from uuid import UUID
from _typeshed import Unused
from django.contrib.admin.options import BaseModelAdmin
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.forms import AdminPasswordChangeForm
from django.db.models.base import Model
from django.db.models.deletion import Collector
from django.db.models.fields import Field, reverse_related
from django.db.models.options import Options
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
from django.forms.forms import BaseForm
from django.forms.formsets import BaseFormSet
from django.http.request import HttpRequest
from django.utils.datastructures import _IndexableCollection
from typing_extensions import TypedDict
_T = TypeVar("_T")
class FieldIsAForeignKeyColumnName(Exception): ...
def lookup_spawns_duplicates(opts: Options, lookup_path: str) -> bool: ...
def get_last_value_from_parameters(parameters: dict[str, list[str] | str], key: str) -> str | None: ...
def prepare_lookup_value(
key: str, value: list[bool | datetime.datetime | str] | datetime.datetime | str, separator: str
) -> list[bool | datetime.datetime | str] | bool | datetime.datetime | str: ...
def build_q_object_from_lookup_parameters(parameters: dict[str, list[str]]) -> Q: ...
def quote(s: int | str | UUID) -> str: ...
def unquote(s: str) -> str: ...
def flatten(fields: Any) -> list[Callable | str]: ...
def flatten_fieldsets(fieldsets: Any) -> list[Callable | str]: ...
def get_deleted_objects(
objs: Sequence[Model | None] | QuerySet[Model], request: HttpRequest, admin_site: AdminSite
) -> tuple[list[str], dict[str, int], set[str], list[str]]: ...
class NestedObjects(Collector):
edges: dict[Model, list[Model]]
protected: set[Model]
model_objs: defaultdict[str, set[Model]]
def add_edge(self, source: Model | None, target: Model) -> None: ...
def collect( # type: ignore[override]
self,
objs: _IndexableCollection[Model | None],
source: type[Model] | None = ...,
source_attr: str | None = ...,
*,
nullable: bool = ...,
collect_related: bool = ...,
reverse_dependency: bool = ...,
keep_parents: bool = ...,
fail_on_restricted: bool = ...,
) -> None: ...
def related_objects(
self, related_model: type[Model], related_fields: Iterable[Field], objs: _IndexableCollection[Model]
) -> QuerySet[Model]: ...
@overload
def nested(self, format_callback: None = None) -> list[Model]: ...
@overload
def nested(self, format_callback: Callable[[Model], _T]) -> list[_T]: ...
def can_fast_delete(self, *args: Unused, **kwargs: Unused) -> Literal[False]: ...
@type_check_only
class _ModelFormatDict(TypedDict):
verbose_name: str
verbose_name_plural: str
def model_format_dict(obj: Model | type[Model] | QuerySet | Options[Model]) -> _ModelFormatDict: ...
def model_ngettext(obj: Options | QuerySet, n: int | None = ...) -> str: ...
def lookup_field(
name: Callable | str, obj: Model, model_admin: BaseModelAdmin | None = ...
) -> tuple[Field | None, str | None, Any]: ...
@overload
def label_for_field(
name: Callable | str,
model: type[Model],
model_admin: BaseModelAdmin | None = ...,
return_attr: Literal[True] = ...,
form: BaseForm | None = ...,
) -> tuple[str, Callable | str | None]: ...
@overload
def label_for_field(
name: Callable | str,
model: type[Model],
model_admin: BaseModelAdmin | None = ...,
return_attr: Literal[False] = ...,
form: BaseForm | None = ...,
) -> str: ...
def help_text_for_field(name: str, model: type[Model]) -> str: ...
def display_for_field(value: Any, field: Field, empty_value_display: str) -> str: ...
def display_for_value(value: Any, empty_value_display: str, boolean: bool = ...) -> str: ...
class NotRelationField(Exception): ...
def get_model_from_relation(field: Field | reverse_related.ForeignObjectRel) -> type[Model]: ...
def reverse_field_path(model: type[Model], path: str) -> tuple[type[Model], str]: ...
def get_fields_from_path(model: type[Model], path: str) -> list[Field]: ...
def construct_change_message(
form: AdminPasswordChangeForm, formsets: Iterable[BaseFormSet], add: bool
) -> list[dict[str, dict[str, list[str]]]]: ...

View File

@@ -1,11 +0,0 @@
from typing import Any
from django.contrib.admin.options import ModelAdmin
from django.db.models import Model
from django.http.request import HttpRequest
from django.views.generic.list import BaseListView
class AutocompleteJsonView(BaseListView):
model_admin: ModelAdmin
term: Any
def has_perm(self, request: HttpRequest, obj: Model | None = ...) -> bool: ...

View File

@@ -1,11 +0,0 @@
from collections.abc import Callable
from typing import TypeVar, overload
_C = TypeVar("_C", bound=Callable)
@overload
def staff_member_required(view_func: _C = ..., redirect_field_name: str | None = ..., login_url: str = ...) -> _C: ...
@overload
def staff_member_required(
view_func: None = ..., redirect_field_name: str | None = ..., login_url: str = ...
) -> Callable: ...

View File

@@ -1,96 +0,0 @@
from collections.abc import Callable, Iterable, Sequence
from typing import Any, Literal
from django import forms
from django.contrib.admin.filters import ListFilter
from django.contrib.admin.options import ModelAdmin, _DisplayT, _ListFilterT
from django.db.models.base import Model
from django.db.models.expressions import Expression
from django.db.models.options import Options
from django.db.models.query import QuerySet
from django.forms.formsets import BaseFormSet
from django.http.request import HttpRequest
ALL_VAR: str
ORDER_VAR: str
PAGE_VAR: str
SEARCH_VAR: str
ERROR_FLAG: str
IGNORED_PARAMS: tuple[str, ...]
class ChangeListSearchForm(forms.Form): ...
class ChangeList:
search_form_class: type[forms.Form]
model: type[Model]
opts: Options
lookup_opts: Options
root_queryset: QuerySet
list_display: _DisplayT
list_display_links: _DisplayT
list_filter: Sequence[_ListFilterT]
date_hierarchy: Any
search_fields: Sequence[str]
search_help_text: str | None
list_select_related: bool | Sequence[str]
list_per_page: int
list_max_show_all: int
model_admin: ModelAdmin
preserved_filters: str
sortable_by: Sequence[str] | None
page_num: int
show_all: bool
is_popup: bool
add_facets: bool
is_facets_optional: bool
to_field: Any
params: dict[str, Any]
filter_params: dict[str, list[str]]
remove_facet_link: str
add_facet_link: str
list_editable: Sequence[str]
query: str
queryset: Any
title: str
pk_attname: str
formset: BaseFormSet | None
def __init__(
self,
request: HttpRequest,
model: type[Model],
list_display: _DisplayT,
list_display_links: _DisplayT,
list_filter: Sequence[_ListFilterT],
date_hierarchy: str | None,
search_fields: Sequence[str],
list_select_related: bool | Sequence[str],
list_per_page: int,
list_max_show_all: int,
list_editable: Sequence[str],
model_admin: ModelAdmin,
sortable_by: Sequence[str] | None,
search_help_text: str | None,
) -> None: ...
def get_filters_params(self, params: dict[str, Any] | None = ...) -> dict[str, Any]: ...
def get_filters(self, request: HttpRequest) -> tuple[list[ListFilter], bool, dict[str, bool | str], bool, bool]: ...
def get_query_string(self, new_params: dict[str, Any] | None = ..., remove: Iterable[str] | None = ...) -> str: ...
result_count: int
show_full_result_count: bool
show_admin_actions: bool
full_result_count: int | None
result_list: Any
can_show_all: bool
multi_page: bool
paginator: Any
def get_results(self, request: HttpRequest) -> None: ...
def get_ordering_field(self, field_name: Callable | str) -> Expression | str | None: ...
def get_ordering(self, request: HttpRequest, queryset: QuerySet) -> list[Expression | str]: ...
def get_ordering_field_columns(self) -> dict[int, Literal["desc", "asc"]]: ...
def get_queryset(self, request: HttpRequest, exclude_parameters: list[str | None] | None = ...) -> QuerySet: ...
filter_specs: list[ListFilter]
has_filters: bool
has_active_filters: bool
clear_all_filters_qs: str
def apply_select_related(self, qs: QuerySet) -> QuerySet: ...
def has_related_field_in_list_display(self) -> bool: ...
def url_for_result(self, result: Model) -> str: ...

View File

@@ -1,159 +0,0 @@
from collections.abc import Iterable, Mapping, Sequence
from typing import Any
from django import forms
from django.contrib.admin.sites import AdminSite
from django.core.files.base import File
from django.db.models.fields.reverse_related import ManyToManyRel, ManyToOneRel
from django.forms.models import ModelChoiceIterator
from django.forms.widgets import ChoiceWidget, _OptAttrs
from django.utils.choices import _Choices
from django.utils.functional import _StrOrPromise
class FilteredSelectMultiple(forms.SelectMultiple):
verbose_name: _StrOrPromise
is_stacked: bool
def __init__(
self,
verbose_name: _StrOrPromise,
is_stacked: bool,
attrs: _OptAttrs | None = ...,
choices: _Choices = ...,
) -> None: ...
class BaseAdminDateWidget(forms.DateInput):
def __init__(self, attrs: _OptAttrs | None = ..., format: str | None = ...) -> None: ...
class AdminDateWidget(BaseAdminDateWidget):
template_name: str
class BaseAdminTimeWidget(forms.TimeInput):
def __init__(self, attrs: _OptAttrs | None = ..., format: str | None = ...) -> None: ...
class AdminTimeWidget(BaseAdminTimeWidget):
template_name: str
class AdminSplitDateTime(forms.SplitDateTimeWidget):
template_name: str
def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...
def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...
class AdminRadioSelect(forms.RadioSelect): ...
class AdminFileWidget(forms.ClearableFileInput): ...
def url_params_from_lookup_dict(lookups: Any) -> dict[str, str]: ...
class ForeignKeyRawIdWidget(forms.TextInput):
rel: ManyToOneRel
admin_site: AdminSite
db: str | None
def __init__(
self,
rel: ManyToOneRel,
admin_site: AdminSite,
attrs: _OptAttrs | None = ...,
using: str | None = ...,
) -> None: ...
def base_url_parameters(self) -> dict[str, str]: ...
def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...
def url_parameters(self) -> dict[str, str]: ...
def label_and_url_for_value(self, value: Any) -> tuple[str, str]: ...
class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
rel: ManyToManyRel # type: ignore[assignment]
def __init__(
self,
rel: ManyToManyRel,
admin_site: AdminSite,
attrs: _OptAttrs | None = ...,
using: str | None = ...,
) -> None: ...
def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...
def url_parameters(self) -> dict[str, str]: ...
def label_and_url_for_value(self, value: Any) -> tuple[str, str]: ...
def format_value(self, value: Any) -> str | None: ...
def value_from_datadict(self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str) -> Any: ...
class RelatedFieldWidgetWrapper(forms.Widget):
template_name: str
widget: ChoiceWidget
rel: ManyToOneRel
can_add_related: bool
can_change_related: bool
can_delete_related: bool
can_view_related: bool
admin_site: AdminSite
def __init__(
self,
widget: ChoiceWidget,
rel: ManyToOneRel,
admin_site: AdminSite,
can_add_related: bool | None = ...,
can_change_related: bool = ...,
can_delete_related: bool = ...,
can_view_related: bool = ...,
) -> None: ...
@property
def is_hidden(self) -> bool: ...
@property
def choices(self) -> ModelChoiceIterator: ...
@choices.setter
def choices(self, value: ModelChoiceIterator) -> None: ...
def get_related_url(self, info: tuple[str, str], action: str, *args: Any) -> str: ...
def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...
def value_from_datadict(self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str) -> Any: ...
def value_omitted_from_data(
self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str
) -> bool: ...
def id_for_label(self, id_: str) -> str: ...
class AdminTextareaWidget(forms.Textarea):
def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...
class AdminTextInputWidget(forms.TextInput):
def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...
class AdminEmailInputWidget(forms.EmailInput):
def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...
class AdminURLFieldWidget(forms.URLInput):
template_name: str
def __init__(self, attrs: _OptAttrs | None = ..., validator_class: Any = ...) -> None: ...
def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...
class AdminIntegerFieldWidget(forms.NumberInput):
def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...
class_name: str
class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget):
class_name: str
class AdminUUIDInputWidget(forms.TextInput):
def __init__(self, attrs: _OptAttrs | None = ...) -> None: ...
SELECT2_TRANSLATIONS: dict[str, str]
class AutocompleteMixin:
url_name: str
field: Any
admin_site: AdminSite
db: str | None
choices: Any
attrs: _OptAttrs
def __init__(
self,
field: Any,
admin_site: AdminSite,
attrs: _OptAttrs | None = ...,
choices: Any = ...,
using: str | None = ...,
) -> None: ...
def get_url(self) -> str: ...
def build_attrs(self, base_attrs: _OptAttrs, extra_attrs: _OptAttrs | None = ...) -> dict[str, Any]: ...
# typo in source: `attr` instead of `attrs`
def optgroups(
self, name: str, value: Sequence[str], attr: _OptAttrs | None = ...
) -> list[tuple[str | None, list[dict[str, Any]], int | None]]: ...
class AutocompleteSelect(AutocompleteMixin, forms.Select): ...
class AutocompleteSelectMultiple(AutocompleteMixin, forms.SelectMultiple): ...

View File

@@ -1,7 +0,0 @@
from typing import Any
from django.apps import AppConfig
class AdminDocsConfig(AppConfig):
name: str
verbose_name: Any

View File

@@ -1,15 +0,0 @@
from collections.abc import Callable
from typing import Any
from django.http.request import HttpRequest
from django.http.response import HttpResponse, HttpResponseBase
from django.utils.deprecation import MiddlewareMixin
class XViewMiddleware(MiddlewareMixin):
def process_view(
self,
request: HttpRequest,
view_func: Callable[..., HttpResponseBase],
view_args: tuple,
view_kwargs: dict[Any, Any],
) -> HttpResponse | None: ...

View File

@@ -1,3 +0,0 @@
from django.urls import _AnyURL
urlpatterns: list[_AnyURL]

View File

@@ -1,29 +0,0 @@
from collections.abc import Callable
from typing import Any
from django.utils.safestring import SafeString
docutils_is_available: bool
def get_view_name(view_func: Callable) -> str: ...
def parse_docstring(docstring: str) -> tuple[str, str, dict[str, str]]: ...
def parse_rst(text: str, default_reference_context: Any, thing_being_parsed: Any | None = ...) -> SafeString: ...
ROLES: dict[str, str]
def create_reference_role(rolename: str, urlbase: str) -> None: ...
def default_reference_role(
name: str,
rawtext: str,
text: str,
lineno: Any,
inliner: Any,
options: Any | None = ...,
content: Any | None = ...,
) -> tuple[list[Any], list[Any]]: ...
named_group_matcher: Any
unnamed_group_matcher: Any
def replace_named_groups(pattern: str) -> str: ...
def replace_unnamed_groups(pattern: str) -> str: ...

View File

@@ -1,26 +0,0 @@
from collections.abc import Callable, Iterable
from re import Pattern
from typing import Any
from django.db.models.fields import Field
from django.urls import _AnyURL
from django.views.generic import TemplateView
MODEL_METHODS_EXCLUDE: Any
class BaseAdminDocsView(TemplateView): ...
class BookmarkletsView(BaseAdminDocsView): ...
class TemplateTagIndexView(BaseAdminDocsView): ...
class TemplateFilterIndexView(BaseAdminDocsView): ...
class ViewIndexView(BaseAdminDocsView): ...
class ViewDetailView(BaseAdminDocsView): ...
class ModelIndexView(BaseAdminDocsView): ...
class ModelDetailView(BaseAdminDocsView): ...
class TemplateDetailView(BaseAdminDocsView): ...
def get_return_data_type(func_name: Any) -> str: ...
def get_readable_field_data_type(field: Field | str) -> str: ...
def extract_views_from_urlpatterns(
urlpatterns: Iterable[_AnyURL], base: str = ..., namespace: str | None = ...
) -> list[tuple[Callable, Pattern[str], str | None, str | None]]: ...
def simplify_regex(pattern: str) -> str: ...

View File

@@ -1,36 +0,0 @@
from typing import Any
from django.contrib.auth.backends import BaseBackend
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import AnonymousUser
from django.db.models.options import Options
from django.http.request import HttpRequest
from django.test.client import Client
from .signals import user_logged_in as user_logged_in
from .signals import user_logged_out as user_logged_out
from .signals import user_login_failed as user_login_failed
SESSION_KEY: str
BACKEND_SESSION_KEY: str
HASH_SESSION_KEY: str
REDIRECT_FIELD_NAME: str
def load_backend(path: str) -> BaseBackend: ...
def get_backends() -> list[BaseBackend]: ...
def authenticate(request: HttpRequest | None = ..., **credentials: Any) -> AbstractBaseUser | None: ...
async def aauthenticate(request: HttpRequest | None = ..., **credentials: Any) -> AbstractBaseUser | None: ...
def login(
request: HttpRequest, user: AbstractBaseUser | None, backend: type[BaseBackend] | str | None = ...
) -> None: ...
async def alogin(
request: HttpRequest, user: AbstractBaseUser | None, backend: type[BaseBackend] | str | None = ...
) -> None: ...
def logout(request: HttpRequest) -> None: ...
async def alogout(request: HttpRequest) -> None: ...
def get_user_model() -> type[AbstractBaseUser]: ...
def get_user(request: HttpRequest | Client) -> AbstractBaseUser | AnonymousUser: ...
async def aget_user(request: HttpRequest | Client) -> AbstractBaseUser | AnonymousUser: ...
def get_permission_codename(action: str, opts: Options) -> str: ...
def update_session_auth_hash(request: HttpRequest, user: AbstractBaseUser) -> None: ...
async def aupdate_session_auth_hash(request: HttpRequest, user: AbstractBaseUser) -> None: ...

View File

@@ -1,20 +0,0 @@
from typing import Any, TypeVar
from django.contrib import admin
from django.contrib.auth.models import AbstractUser, Group
from django.http.request import HttpRequest
from django.http.response import HttpResponse
_AbstractUserT = TypeVar("_AbstractUserT", bound=AbstractUser)
csrf_protect_m: Any
sensitive_post_parameters_m: Any
class GroupAdmin(admin.ModelAdmin[Group]): ...
class UserAdmin(admin.ModelAdmin[_AbstractUserT]):
change_user_password_template: Any
add_fieldsets: Any
add_form: Any
change_password_form: Any
def user_change_password(self, request: HttpRequest, id: str, form_url: str = ...) -> HttpResponse: ...

View File

@@ -1,3 +0,0 @@
from django.apps import AppConfig
class AuthConfig(AppConfig): ...

View File

@@ -1,45 +0,0 @@
from typing import Any, TypeVar
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import AnonymousUser, Permission
from django.db.models import QuerySet
from django.db.models.base import Model
from django.http.request import HttpRequest
from typing_extensions import TypeAlias
_AnyUser: TypeAlias = AbstractBaseUser | AnonymousUser
UserModel: Any
class BaseBackend:
def authenticate(self, request: HttpRequest | None, **kwargs: Any) -> AbstractBaseUser | None: ...
def get_user(self, user_id: Any) -> AbstractBaseUser | None: ...
def get_user_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ...
def get_group_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ...
def get_all_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ...
def has_perm(self, user_obj: _AnyUser, perm: str, obj: Model | None = ...) -> bool: ...
class ModelBackend(BaseBackend):
def authenticate(
self, request: HttpRequest | None, username: str | None = ..., password: str | None = ..., **kwargs: Any
) -> AbstractBaseUser | None: ...
def has_module_perms(self, user_obj: _AnyUser, app_label: str) -> bool: ...
def user_can_authenticate(self, user: _AnyUser | None) -> bool: ...
def with_perm(
self,
perm: str | Permission,
is_active: bool = ...,
include_superusers: bool = ...,
obj: Model | None = ...,
) -> QuerySet[AbstractBaseUser]: ...
class AllowAllUsersModelBackend(ModelBackend): ...
_U = TypeVar("_U", bound=AbstractBaseUser)
class RemoteUserBackend(ModelBackend):
create_unknown_user: bool
def clean_username(self, username: str) -> str: ...
def configure_user(self, request: HttpRequest, user: _U, created: bool = ...) -> _U: ...
class AllowAllUsersRemoteUserBackend(RemoteUserBackend): ...

View File

@@ -1,43 +0,0 @@
from typing import Any, ClassVar, Literal, TypeVar, overload
from django.db import models
from django.db.models.base import Model
from django.db.models.expressions import Combinable
from django.db.models.fields import BooleanField
_T = TypeVar("_T", bound=Model)
class BaseUserManager(models.Manager[_T]):
@classmethod
def normalize_email(cls, email: str | None) -> str: ...
def make_random_password(self, length: int = ..., allowed_chars: str = ...) -> str: ...
def get_by_natural_key(self, username: str | None) -> _T: ...
class AbstractBaseUser(models.Model):
REQUIRED_FIELDS: ClassVar[list[str]]
password = models.CharField(max_length=128)
last_login = models.DateTimeField(blank=True, null=True)
is_active: bool | BooleanField[bool | Combinable, bool]
def get_username(self) -> str: ...
def natural_key(self) -> tuple[str]: ...
@property
def is_anonymous(self) -> Literal[False]: ...
@property
def is_authenticated(self) -> Literal[True]: ...
def set_password(self, raw_password: str | None) -> None: ...
def check_password(self, raw_password: str) -> bool: ...
async def acheck_password(self, raw_password: str) -> bool: ...
def set_unusable_password(self) -> None: ...
def has_usable_password(self) -> bool: ...
def get_session_auth_hash(self) -> str: ...
def get_session_auth_fallback_hash(self) -> str: ...
@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: ...

View File

@@ -1,10 +0,0 @@
from collections.abc import Sequence
from typing import Any
from django.apps.config import AppConfig
from django.core.checks.messages import CheckMessage
def check_user_model(app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any) -> Sequence[CheckMessage]: ...
def check_models_permissions(
app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any
) -> Sequence[CheckMessage]: ...

View File

@@ -1,21 +0,0 @@
from collections.abc import Iterator
from typing import Any
from django.http.request import HttpRequest
class PermLookupDict:
app_label: str
user: Any
def __init__(self, user: Any, app_label: str) -> None: ...
def __getitem__(self, perm_name: str) -> bool: ...
def __iter__(self) -> Iterator[Any]: ...
def __bool__(self) -> bool: ...
class PermWrapper:
user: Any
def __init__(self, user: Any) -> None: ...
def __getitem__(self, app_label: str) -> PermLookupDict: ...
def __iter__(self) -> Iterator[Any]: ...
def __contains__(self, perm_name: Any) -> bool: ...
def auth(request: HttpRequest) -> dict[str, Any]: ...

View File

@@ -1,22 +0,0 @@
from collections.abc import Callable, Iterable
from typing import TypeVar, overload
from django.contrib.auth.models import AbstractBaseUser, AnonymousUser
from django.http.response import HttpResponseBase
_VIEW = TypeVar("_VIEW", bound=Callable[..., HttpResponseBase])
def user_passes_test(
test_func: Callable[[AbstractBaseUser | AnonymousUser], bool],
login_url: str | None = ...,
redirect_field_name: str | None = ...,
) -> Callable[[_VIEW], _VIEW]: ...
# There are two ways of calling @login_required: @with(arguments) and @bare
@overload
def login_required(redirect_field_name: str | None = ..., login_url: str | None = ...) -> Callable[[_VIEW], _VIEW]: ...
@overload
def login_required(function: _VIEW, redirect_field_name: str | None = ..., login_url: str | None = ...) -> _VIEW: ...
def permission_required(
perm: Iterable[str] | str, login_url: str | None = ..., raise_exception: bool = ...
) -> Callable[[_VIEW], _VIEW]: ...

View File

@@ -1,107 +0,0 @@
from collections.abc import Iterable
from typing import Any, TypeVar
from django import forms
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models.fields import _ErrorMessagesDict
from django.forms.fields import _ClassLevelWidgetT
from django.forms.widgets import Widget
from django.http.request import HttpRequest
UserModel: type[AbstractBaseUser]
_User = TypeVar("_User", bound=AbstractBaseUser)
class ReadOnlyPasswordHashWidget(forms.Widget):
template_name: str
read_only: bool
def get_context(self, name: str, value: Any, attrs: dict[str, Any] | None) -> dict[str, Any]: ...
class ReadOnlyPasswordHashField(forms.Field):
widget: _ClassLevelWidgetT
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
class UsernameField(forms.CharField):
def to_python(self, value: Any | None) -> Any | None: ...
def widget_attrs(self, widget: Widget) -> dict[str, Any]: ...
class BaseUserCreationForm(forms.ModelForm[_User]):
error_messages: _ErrorMessagesDict
password1: forms.Field
password2: forms.Field
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def clean_password2(self) -> str: ...
def save(self, commit: bool = ...) -> _User: ...
class UserCreationForm(BaseUserCreationForm[_User]):
def clean_username(self) -> str: ...
class UserChangeForm(forms.ModelForm[_User]):
password: forms.Field
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
class AuthenticationForm(forms.Form):
username: forms.Field
password: forms.Field
error_messages: _ErrorMessagesDict
request: HttpRequest | None
user_cache: Any
username_field: models.Field
def __init__(self, request: HttpRequest | None = ..., *args: Any, **kwargs: Any) -> None: ...
def confirm_login_allowed(self, user: AbstractBaseUser) -> None: ...
def get_user(self) -> AbstractBaseUser: ...
def get_invalid_login_error(self) -> ValidationError: ...
def clean(self) -> dict[str, Any]: ...
class PasswordResetForm(forms.Form):
email: forms.Field
def send_mail(
self,
subject_template_name: str,
email_template_name: str,
context: dict[str, Any],
from_email: str | None,
to_email: str,
html_email_template_name: str | None = ...,
) -> None: ...
def get_users(self, email: str) -> Iterable[AbstractBaseUser]: ...
def save(
self,
domain_override: str | None = ...,
subject_template_name: str = ...,
email_template_name: str = ...,
use_https: bool = ...,
token_generator: PasswordResetTokenGenerator = ...,
from_email: str | None = ...,
request: HttpRequest | None = ...,
html_email_template_name: str | None = ...,
extra_email_context: dict[str, str] | None = ...,
) -> None: ...
class SetPasswordForm(forms.Form):
error_messages: _ErrorMessagesDict
new_password1: forms.Field
new_password2: forms.Field
user: AbstractBaseUser
def __init__(self, user: AbstractBaseUser, *args: Any, **kwargs: Any) -> None: ...
def clean_new_password2(self) -> str: ...
def save(self, commit: bool = ...) -> AbstractBaseUser: ...
class PasswordChangeForm(SetPasswordForm):
error_messages: _ErrorMessagesDict
old_password: forms.Field
def clean_old_password(self) -> str: ...
class AdminPasswordChangeForm(forms.Form):
error_messages: _ErrorMessagesDict
required_css_class: str
password1: forms.Field
password2: forms.Field
user: AbstractBaseUser
def __init__(self, user: AbstractBaseUser, *args: Any, **kwargs: Any) -> None: ...
def clean_password2(self) -> str: ...
def save(self, commit: bool = ...) -> AbstractBaseUser: ...
@property
def changed_data(self) -> list[str]: ...

View File

@@ -1,6 +0,0 @@
from typing import Any
UserModel: Any
def check_password(environ: dict[Any, Any], username: str, password: str) -> Any: ...
def groups_for_user(environ: dict[Any, Any], username: str) -> Any: ...

View File

@@ -1,61 +0,0 @@
from collections.abc import Callable
from typing import Any
UNUSABLE_PASSWORD_PREFIX: str
UNUSABLE_PASSWORD_SUFFIX_LENGTH: int
def is_password_usable(encoded: str | None) -> bool: ...
def verify_password(password: str | None, encoded: str, preferred: str = ...) -> tuple[bool, bool]: ...
def check_password(password: str | None, encoded: str, setter: Callable | None = ..., preferred: str = ...) -> bool: ...
async def acheck_password(
password: str | None, encoded: str, setter: Callable | None = ..., preferred: str = ...
) -> bool: ...
def make_password(password: str | None, salt: str | None = ..., hasher: str | BasePasswordHasher = ...) -> str: ...
def get_hashers() -> list[BasePasswordHasher]: ...
def get_hashers_by_algorithm() -> dict[str, BasePasswordHasher]: ...
def reset_hashers(**kwargs: Any) -> None: ...
def get_hasher(algorithm: str | BasePasswordHasher = ...) -> BasePasswordHasher: ...
def identify_hasher(encoded: str) -> BasePasswordHasher: ...
def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ...
class BasePasswordHasher:
algorithm: str | None
library: str | tuple[str, str] | None
rounds: int
time_cost: int
memory_cost: int
parallelism: int
digest: Any
iterations: int
salt_entropy: int
def salt(self) -> str: ...
def verify(self, password: str, encoded: str) -> bool: ...
def encode(self, password: str, salt: str) -> str: ...
def decode(self, encoded: str) -> dict[str, Any]: ...
def safe_summary(self, encoded: str) -> dict[str, Any]: ...
def must_update(self, encoded: str) -> bool: ...
def harden_runtime(self, password: str, encoded: str) -> None: ...
class PBKDF2PasswordHasher(BasePasswordHasher):
def encode(self, password: str, salt: str, iterations: int | None = ...) -> str: ...
def decode(self, encoded: str) -> dict[str, str | int]: ...
class PBKDF2SHA1PasswordHasher(PBKDF2PasswordHasher): ...
class Argon2PasswordHasher(BasePasswordHasher): ...
class BCryptSHA256PasswordHasher(BasePasswordHasher):
def decode(self, encoded: str) -> dict[str, str | int]: ...
class BCryptPasswordHasher(BCryptSHA256PasswordHasher): ...
class SHA1PasswordHasher(BasePasswordHasher):
def decode(self, encoded: str) -> dict[str, str]: ...
class MD5PasswordHasher(BasePasswordHasher):
def decode(self, encoded: str) -> dict[str, str]: ...
class UnsaltedSHA1PasswordHasher(BasePasswordHasher):
def decode(self, encoded: str) -> dict[str, str | None]: ...
class UnsaltedMD5PasswordHasher(BasePasswordHasher):
def decode(self, encoded: str) -> dict[str, str | None]: ...

View File

@@ -1,15 +0,0 @@
from typing import Any
from django.apps.config import AppConfig
from django.apps.registry import Apps
def create_permissions(
app_config: AppConfig,
verbosity: int = ...,
interactive: bool = ...,
using: str = ...,
apps: Apps = ...,
**kwargs: Any,
) -> None: ...
def get_system_username() -> str: ...
def get_default_username(check_db: bool = ..., database: str = ...) -> str: ...

View File

@@ -1,7 +0,0 @@
from typing import Any
from django.core.management.base import BaseCommand
UserModel: Any
class Command(BaseCommand): ...

View File

@@ -1,9 +0,0 @@
import getpass as getpass
from typing import Any
from django.core.management.base import BaseCommand
class NotRunningInTTYException(Exception): ...
class Command(BaseCommand):
stdin: Any

View File

@@ -1,19 +0,0 @@
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import AnonymousUser
from django.http.request import HttpRequest
from django.utils.deprecation import MiddlewareMixin
def get_user(request: HttpRequest) -> AnonymousUser | AbstractBaseUser: ...
async def auser(request: HttpRequest) -> AnonymousUser | AbstractBaseUser: ...
class AuthenticationMiddleware(MiddlewareMixin):
def process_request(self, request: HttpRequest) -> None: ...
class RemoteUserMiddleware(MiddlewareMixin):
header: str
force_logout_if_no_header: bool
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

View File

@@ -1,30 +0,0 @@
from collections.abc import Callable, Sequence
from typing import Any
from django import http
from django.http.response import HttpResponseBase, HttpResponseRedirect
from django.utils.functional import _StrOrPromise
class AccessMixin:
login_url: Any
permission_denied_message: _StrOrPromise
raise_exception: bool
redirect_field_name: Any
def get_login_url(self) -> str: ...
def get_permission_denied_message(self) -> _StrOrPromise: ...
def get_redirect_field_name(self) -> str: ...
def handle_no_permission(self) -> HttpResponseRedirect: ...
class LoginRequiredMixin(AccessMixin):
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ...
class PermissionRequiredMixin(AccessMixin):
permission_required: Any
def get_permission_required(self) -> Sequence[str]: ...
def has_permission(self) -> bool: ...
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ...
class UserPassesTestMixin(AccessMixin):
def test_func(self) -> bool | None: ...
def get_test_func(self) -> Callable: ...
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ...

View File

@@ -1,120 +0,0 @@
from collections.abc import Iterable
from typing import Any, ClassVar, Literal, TypeVar
from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser
from django.contrib.auth.base_user import BaseUserManager as BaseUserManager
from django.contrib.auth.validators import UnicodeUsernameValidator
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import QuerySet
from django.db.models.base import Model
from django.db.models.manager import EmptyManager
from django.utils.functional import _StrOrPromise
from typing_extensions import Self, TypeAlias
_AnyUser: TypeAlias = Model | AnonymousUser
def update_last_login(sender: type[AbstractBaseUser], user: AbstractBaseUser, **kwargs: Any) -> None: ...
class PermissionManager(models.Manager[Permission]):
def get_by_natural_key(self, codename: str, app_label: str, model: str) -> Permission: ...
class Permission(models.Model):
content_type_id: int
objects: ClassVar[PermissionManager]
name = models.CharField(max_length=255)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
codename = models.CharField(max_length=100)
def natural_key(self) -> tuple[str, str, str]: ...
class GroupManager(models.Manager[Group]):
def get_by_natural_key(self, name: str) -> Group: ...
class Group(models.Model):
objects: ClassVar[GroupManager]
name = models.CharField(max_length=150)
permissions = models.ManyToManyField(Permission)
def natural_key(self) -> tuple[str]: ...
_T = TypeVar("_T", bound=Model)
class UserManager(BaseUserManager[_T]):
def create_user(
self, username: str, email: str | None = ..., password: str | None = ..., **extra_fields: Any
) -> _T: ...
def create_superuser(
self, username: str, email: str | None = ..., password: str | None = ..., **extra_fields: Any
) -> _T: ...
def with_perm(
self,
perm: str | Permission,
is_active: bool = ...,
include_superusers: bool = ...,
backend: str | None = ...,
obj: Model | None = ...,
) -> QuerySet[_T]: ...
class PermissionsMixin(models.Model):
is_superuser = models.BooleanField()
groups = models.ManyToManyField(Group)
user_permissions = models.ManyToManyField(Permission)
def get_user_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
def get_group_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
def get_all_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
def has_perm(self, perm: str, obj: _AnyUser | None = ...) -> bool: ...
def has_perms(self, perm_list: Iterable[str], obj: _AnyUser | None = ...) -> bool: ...
def has_module_perms(self, app_label: str) -> bool: ...
class AbstractUser(AbstractBaseUser, PermissionsMixin):
username_validator: UnicodeUsernameValidator
username = models.CharField(max_length=150)
first_name = models.CharField(max_length=30, blank=True)
last_name = models.CharField(max_length=150, blank=True)
email = models.EmailField(blank=True)
is_staff = models.BooleanField()
is_active = models.BooleanField()
date_joined = models.DateTimeField()
objects: ClassVar[UserManager[Self]]
EMAIL_FIELD: str
USERNAME_FIELD: str
def get_full_name(self) -> str: ...
def get_short_name(self) -> str: ...
def email_user(
self, subject: _StrOrPromise, message: _StrOrPromise, from_email: str = ..., **kwargs: Any
) -> None: ...
class User(AbstractUser): ...
class AnonymousUser:
id: Any
pk: Any
username: Literal[""]
is_staff: Literal[False]
is_active: Literal[False]
is_superuser: Literal[False]
def save(self) -> None: ...
def delete(self) -> None: ...
def set_password(self, raw_password: str) -> None: ...
def check_password(self, raw_password: str) -> Any: ...
@property
def groups(self) -> EmptyManager[Group]: ...
@property
def user_permissions(self) -> EmptyManager[Permission]: ...
def get_user_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
def get_group_permissions(self, obj: _AnyUser | None = ...) -> set[Any]: ...
def get_all_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
def has_perm(self, perm: str, obj: _AnyUser | None = ...) -> bool: ...
def has_perms(self, perm_list: Iterable[str], obj: _AnyUser | None = ...) -> bool: ...
def has_module_perms(self, module: str) -> bool: ...
@property
def is_anonymous(self) -> Literal[True]: ...
@property
def is_authenticated(self) -> Literal[False]: ...
def get_username(self) -> str: ...

View File

@@ -1,50 +0,0 @@
from collections.abc import Mapping, Sequence
from pathlib import Path, PosixPath
from typing import Any, Protocol, type_check_only
from django.db.models.base import Model
from typing_extensions import TypeAlias
_UserModel: TypeAlias = Model
@type_check_only
class PasswordValidator(Protocol):
def validate(self, password: str, user: _UserModel | None = ..., /) -> None: ...
def get_help_text(self) -> str: ...
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: _UserModel | None = ..., password_validators: Sequence[PasswordValidator] | None = ...
) -> None: ...
def password_changed(
password: str, user: _UserModel | None = ..., password_validators: Sequence[PasswordValidator] | None = ...
) -> None: ...
def password_validators_help_texts(password_validators: Sequence[PasswordValidator] | None = ...) -> 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: _UserModel | None = ...) -> None: ...
def get_help_text(self) -> str: ...
class UserAttributeSimilarityValidator:
DEFAULT_USER_ATTRIBUTES: Sequence[str]
user_attributes: Sequence[str]
max_similarity: float
def __init__(self, user_attributes: Sequence[str] = ..., max_similarity: float = ...) -> None: ...
def validate(self, password: str, user: _UserModel | None = ...) -> None: ...
def get_help_text(self) -> str: ...
class CommonPasswordValidator:
DEFAULT_PASSWORD_LIST_PATH: Path
passwords: set[str]
def __init__(self, password_list_path: Path | PosixPath | str = ...) -> None: ...
def validate(self, password: str, user: _UserModel | None = ...) -> None: ...
def get_help_text(self) -> str: ...
class NumericPasswordValidator:
def validate(self, password: str, user: _UserModel | None = ...) -> None: ...
def get_help_text(self) -> str: ...

View File

@@ -1,5 +0,0 @@
from django.dispatch.dispatcher import Signal
user_logged_in: Signal
user_login_failed: Signal
user_logged_out: Signal

View File

@@ -1,18 +0,0 @@
from datetime import date, datetime
from typing import Any
from django.contrib.auth.base_user import AbstractBaseUser
class PasswordResetTokenGenerator:
key_salt: str
secret: str | bytes
secret_fallbacks: list[str | bytes]
algorithm: str
def make_token(self, user: AbstractBaseUser) -> str: ...
def check_token(self, user: AbstractBaseUser | None, token: str | None) -> bool: ...
def _make_token_with_timestamp(self, user: AbstractBaseUser, timestamp: int, secret: str | bytes = ...) -> str: ...
def _make_hash_value(self, user: AbstractBaseUser, timestamp: int) -> str: ...
def _num_seconds(self, dt: datetime | date) -> int: ...
def _now(self) -> datetime: ...
default_token_generator: Any

View File

@@ -1,3 +0,0 @@
from django.urls import _AnyURL
urlpatterns: list[_AnyURL]

View File

@@ -1,4 +0,0 @@
from django.core.validators import RegexValidator
class ASCIIUsernameValidator(RegexValidator): ...
class UnicodeUsernameValidator(RegexValidator): ...

View File

@@ -1,77 +0,0 @@
from typing import Any
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.forms import AuthenticationForm
from django.http.request import HttpRequest
from django.http.response import HttpResponse, HttpResponseRedirect
from django.views.generic.base import TemplateView
from django.views.generic.edit import FormView
UserModel: Any
class RedirectURLMixin:
next_page: str | None
redirect_field_name: str
success_url_allowed_hosts: set[str]
def get_success_url(self) -> str: ...
def get_redirect_url(self) -> str: ...
def get_success_url_allowed_hosts(self) -> set[str]: ...
def get_default_redirect_url(self) -> str: ...
class LoginView(RedirectURLMixin, FormView[AuthenticationForm]):
authentication_form: Any
redirect_field_name: Any
redirect_authenticated_user: bool
extra_context: Any
def get_redirect_url(self) -> str: ...
class LogoutView(RedirectURLMixin, TemplateView):
next_page: str | None
redirect_field_name: str
extra_context: Any
def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
def get_next_page(self) -> str | None: ...
def logout_then_login(request: HttpRequest, login_url: str | None = ...) -> HttpResponseRedirect: ...
def redirect_to_login(
next: str, login_url: str | None = ..., redirect_field_name: str | None = ...
) -> HttpResponseRedirect: ...
class PasswordContextMixin:
extra_context: Any
def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ...
class PasswordResetView(PasswordContextMixin, FormView):
email_template_name: str
extra_email_context: Any
from_email: Any
html_email_template_name: Any
subject_template_name: str
title: Any
token_generator: Any
INTERNAL_RESET_URL_TOKEN: str
INTERNAL_RESET_SESSION_TOKEN: str
class PasswordResetDoneView(PasswordContextMixin, TemplateView):
title: Any
class PasswordResetConfirmView(PasswordContextMixin, FormView):
post_reset_login: bool
post_reset_login_backend: Any
reset_url_token: str
title: Any
token_generator: Any
validlink: bool
user: Any
def get_user(self, uidb64: str) -> AbstractBaseUser | None: ...
class PasswordResetCompleteView(PasswordContextMixin, TemplateView):
title: Any
class PasswordChangeView(PasswordContextMixin, FormView):
title: Any
class PasswordChangeDoneView(PasswordContextMixin, TemplateView):
title: Any

View File

@@ -1,15 +0,0 @@
from typing import Any
from django.contrib.admin.checks import InlineModelAdminChecks
from django.contrib.admin.options import InlineModelAdmin
from django.db.models.base import Model
class GenericInlineModelAdminChecks(InlineModelAdminChecks):
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): ...

View File

@@ -1,3 +0,0 @@
from django.apps import AppConfig
class ContentTypesConfig(AppConfig): ...

View File

@@ -1,12 +0,0 @@
from collections.abc import Sequence
from typing import Any
from django.apps.config import AppConfig
from django.core.checks.messages import CheckMessage
def check_generic_foreign_keys(
app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any
) -> Sequence[CheckMessage]: ...
def check_model_name_lengths(
app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any
) -> Sequence[CheckMessage]: ...

View File

@@ -1,97 +0,0 @@
from collections.abc import Callable
from typing import Any
from django.contrib.contenttypes.models import ContentType
from django.core.checks.messages import CheckMessage
from django.db.models.base import Model
from django.db.models.expressions import Combinable
from django.db.models.fields import Field
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import ForeignObject
from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.query import QuerySet
from django.db.models.query_utils import FilteredRelation, PathInfo
from django.db.models.sql.where import WhereNode
class GenericForeignKey(FieldCacheMixin):
# django-stubs implementation only fields
_pyi_private_set_type: Any | Combinable
_pyi_private_get_type: Any
# attributes
auto_created: bool
concrete: bool
editable: bool
hidden: bool
is_relation: bool
many_to_many: bool
many_to_one: bool
one_to_many: bool
one_to_one: bool
related_model: Any
remote_field: Any
ct_field: str
fk_field: str
for_concrete_model: bool
rel: None
column: None
def __init__(self, ct_field: str = ..., fk_field: str = ..., for_concrete_model: bool = ...) -> None: ...
name: Any
model: Any
def contribute_to_class(self, cls: type[Model], name: str, **kwargs: Any) -> None: ...
def get_filter_kwargs_for_object(self, obj: Model) -> dict[str, ContentType | None]: ...
def get_forward_related_filter(self, obj: Model) -> dict[str, int]: ...
def check(self, **kwargs: Any) -> list[CheckMessage]: ...
def get_cache_name(self) -> str: ...
def get_content_type(
self, obj: Model | None = ..., id: int | None = ..., using: str | None = ..., model: type[Model] | None = ...
) -> ContentType: ...
def get_prefetch_queryset(
self, instances: list[Model] | QuerySet, queryset: QuerySet | None = ...
) -> tuple[list[Model], Callable, Callable, bool, str, bool]: ...
def get_prefetch_querysets(
self, instances: list[Model] | QuerySet, querysets: list[QuerySet] | None = ...
) -> tuple[list[Model], Callable, Callable, bool, str, bool]: ...
def __get__(self, instance: Model | None, cls: type[Model] | None = ...) -> Any | None: ...
def __set__(self, instance: Model, value: Any | None) -> None: ...
class GenericRel(ForeignObjectRel):
field: GenericRelation
def __init__(
self,
field: GenericRelation,
to: type[Model] | str,
related_name: str | None = ...,
related_query_name: str | None = ...,
limit_choices_to: dict[str, Any] | Callable[[], Any] | None = ...,
) -> None: ...
class GenericRelation(ForeignObject):
rel_class: Any
mti_inherited: bool
object_id_field_name: str
content_type_field_name: str
for_concrete_model: bool
to_fields: Any
def __init__(
self,
to: type[Model] | str,
object_id_field: str = ...,
content_type_field: str = ...,
for_concrete_model: bool = ...,
related_query_name: str | None = ...,
limit_choices_to: dict[str, Any] | Callable[[], Any] | None = ...,
**kwargs: Any,
) -> None: ...
def resolve_related_fields(self) -> list[tuple[Field, Field]]: ...
def get_path_info(self, filtered_relation: FilteredRelation | None = ...) -> list[PathInfo]: ...
def get_reverse_path_info(self, filtered_relation: FilteredRelation | None = ...) -> list[PathInfo]: ...
def get_content_type(self) -> ContentType: ...
def get_extra_restriction(
self, where_class: type[WhereNode], alias: str | None, remote_alias: str
) -> WhereNode: ...
def bulk_related_objects(self, objs: list[Model], using: str = ...) -> QuerySet: ...
class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor): ...
def create_generic_related_manager(superclass: Any, rel: Any) -> type[Any]: ... # GenericRelatedObjectManager

View File

@@ -1,47 +0,0 @@
from typing import Any, TypeVar
from django.db.models import Model
from django.forms.models import BaseModelFormSet, ModelForm
_M = TypeVar("_M", bound=Model)
_ModelFormT = TypeVar("_ModelFormT", bound=ModelForm)
class BaseGenericInlineFormSet(BaseModelFormSet[_M, _ModelFormT]):
instance: Any
rel_name: Any
save_as_new: Any
def __init__(
self,
data: Any | None = ...,
files: Any | None = ...,
instance: Any | None = ...,
save_as_new: bool = ...,
prefix: Any | None = ...,
queryset: Any | None = ...,
**kwargs: Any,
) -> None: ...
def initial_form_count(self) -> int: ...
@classmethod
def get_default_prefix(cls) -> str: ...
def save_new(self, form: Any, commit: bool = ...) -> _M: ...
def generic_inlineformset_factory(
model: type[_M],
form: type[_ModelFormT] = ...,
formset: Any = ...,
ct_field: str = ...,
fk_field: str = ...,
fields: Any | None = ...,
exclude: Any | None = ...,
extra: int = ...,
can_order: bool = ...,
can_delete: bool = ...,
max_num: Any | None = ...,
formfield_callback: Any | None = ...,
validate_max: bool = ...,
for_concrete_model: bool = ...,
min_num: Any | None = ...,
validate_min: bool = ...,
absolute_max: int | None = ...,
can_delete_extra: bool = ...,
) -> type[BaseGenericInlineFormSet[_M, _ModelFormT]]: ...

View File

@@ -1,33 +0,0 @@
from typing import Any
from django.apps.config import AppConfig
from django.apps.registry import Apps
from django.contrib.contenttypes.models import ContentType
from django.db import migrations
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.migration import Migration
from django.db.migrations.state import StateApps
from django.db.models.base import Model
class RenameContentType(migrations.RunPython):
app_label: str
old_model: str
new_model: str
def __init__(self, app_label: str, old_model: str, new_model: str) -> None: ...
def rename_forward(self, apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: ...
def rename_backward(self, apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: ...
def inject_rename_contenttypes_operations(
plan: list[tuple[Migration, bool]] | None = ..., apps: StateApps = ..., using: str = ..., **kwargs: Any
) -> None: ...
def get_contenttypes_and_models(
app_config: AppConfig, using: str, ContentType: type[ContentType]
) -> tuple[dict[str, ContentType], dict[str, type[Model]]]: ...
def create_contenttypes(
app_config: AppConfig,
verbosity: int = ...,
interactive: bool = ...,
using: str = ...,
apps: Apps = ...,
**kwargs: Any,
) -> None: ...

View File

@@ -1,11 +0,0 @@
from typing import Any, Literal
from _typeshed import Unused
from django.core.management import BaseCommand
from django.db.models.deletion import Collector
class Command(BaseCommand):
def handle(self, **options: Any) -> None: ...
class NoFastDeleteCollector(Collector):
def can_fast_delete(self, *args: Unused, **kwargs: Unused) -> Literal[False]: ...

View File

@@ -1,24 +0,0 @@
from typing import Any, ClassVar
from django.db import models
from django.db.models.base import Model
from django.db.models.query import QuerySet
class ContentTypeManager(models.Manager[ContentType]):
def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ...
def get_for_model(self, model: type[Model] | Model, for_concrete_model: bool = ...) -> ContentType: ...
def get_for_models(self, *models: Any, for_concrete_models: bool = ...) -> dict[type[Model], ContentType]: ...
def get_for_id(self, id: int) -> ContentType: ...
def clear_cache(self) -> None: ...
class ContentType(models.Model):
id: int
app_label: models.CharField
model: models.CharField
objects: ClassVar[ContentTypeManager]
@property
def name(self) -> str: ...
def model_class(self) -> type[Model] | None: ...
def get_object_for_this_type(self, **kwargs: Any) -> Model: ...
def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet: ...
def natural_key(self) -> tuple[str, str]: ...

View File

@@ -1,9 +0,0 @@
from typing import Any
from django.db.models import Prefetch
from django.db.models.query import QuerySet
class GenericPrefetch(Prefetch):
def __init__(self, lookup: str, querysets: list[QuerySet], to_attr: str | None = ...) -> None: ...
def __getstate__(self) -> dict[str, Any]: ...
def get_current_querysets(self, level: int) -> list[QuerySet] | None: ...

View File

@@ -1,4 +0,0 @@
from django.http.request import HttpRequest
from django.http.response import HttpResponseRedirect
def shortcut(request: HttpRequest, content_type_id: int | str, object_id: int | str) -> HttpResponseRedirect: ...

View File

@@ -1,11 +0,0 @@
from typing import Any
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
class FlatPageAdmin(admin.ModelAdmin[FlatPage]):
form: Any
fieldsets: Any
list_display: Any
list_filter: Any
search_fields: Any

View File

@@ -1,7 +0,0 @@
from typing import Any
from django.apps import AppConfig
class FlatPagesConfig(AppConfig):
name: str
verbose_name: Any

View File

@@ -1,7 +0,0 @@
from typing import Any
from django import forms
class FlatpageForm(forms.ModelForm):
url: Any
def clean_url(self) -> str: ...

View File

@@ -1,6 +0,0 @@
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from django.utils.deprecation import MiddlewareMixin
class FlatpageFallbackMiddleware(MiddlewareMixin):
def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...

View File

@@ -1,12 +0,0 @@
from django.contrib.sites.models import Site
from django.db import models
class FlatPage(models.Model):
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, Site]
def get_absolute_url(self) -> str: ...

View File

@@ -1,3 +0,0 @@
from django.contrib.sitemaps import Sitemap
class FlatPageSitemap(Sitemap): ...

View File

@@ -1,16 +0,0 @@
from typing import Any
from django import template
from django.template.base import Parser, Token
from django.template.context import Context
register: Any
class FlatpageNode(template.Node):
context_name: str
starts_with: None
user: None
def __init__(self, context_name: str, starts_with: str | None = ..., user: str | None = ...) -> None: ...
def render(self, context: Context) -> str: ...
def get_flatpages(parser: Parser, token: Token) -> FlatpageNode: ...

View File

@@ -1,3 +0,0 @@
from django.urls import _AnyURL
urlpatterns: list[_AnyURL]

View File

@@ -1,8 +0,0 @@
from django.contrib.flatpages.models import FlatPage
from django.http.request import HttpRequest
from django.http.response import HttpResponse
DEFAULT_TEMPLATE: str
def flatpage(request: HttpRequest, url: str) -> HttpResponse: ...
def render_flatpage(request: HttpRequest, f: FlatPage) -> HttpResponse: ...

View File

@@ -1,11 +0,0 @@
from django.contrib.admin import HORIZONTAL as HORIZONTAL
from django.contrib.admin import VERTICAL as VERTICAL
from django.contrib.admin import AdminSite as AdminSite
from django.contrib.admin import ModelAdmin as ModelAdmin
from django.contrib.admin import StackedInline as StackedInline
from django.contrib.admin import TabularInline as TabularInline
from django.contrib.admin import action as action
from django.contrib.admin import autodiscover as autodiscover
from django.contrib.admin import register as register
from django.contrib.admin import site as site
from django.contrib.gis.admin.options import GISModelAdmin as GISModelAdmin

View File

@@ -1,8 +0,0 @@
from typing import Any
from django.contrib.admin import ModelAdmin
from django.contrib.gis.forms import BaseGeometryWidget
class GISModelAdmin(ModelAdmin):
gis_widget: BaseGeometryWidget
gis_widget_kwargs: dict[str, Any]

View File

@@ -1,3 +0,0 @@
from django.apps import AppConfig
class GISConfig(AppConfig): ...

Some files were not shown because too many files have changed in this diff Show More