mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 14:01:56 +08:00
reformat with black
This commit is contained in:
@@ -14,6 +14,7 @@ from django.db.models.options import Options
|
||||
from django.http.request import HttpRequest
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
from typing import Any, Dict, List, Optional, Type, Union
|
||||
|
||||
SESSION_KEY: str
|
||||
BACKEND_SESSION_KEY: str
|
||||
HASH_SESSION_KEY: str
|
||||
@@ -22,10 +23,18 @@ REDIRECT_FIELD_NAME: str
|
||||
def load_backend(path: str) -> object: ...
|
||||
def _get_backends(return_tuples: bool = ...) -> Any: ...
|
||||
def get_backends() -> List[ModelBackend]: ...
|
||||
def _clean_credentials(credentials: Dict[str, Optional[str]]) -> Dict[str, Optional[str]]: ...
|
||||
def _clean_credentials(
|
||||
credentials: Dict[str, Optional[str]]
|
||||
) -> Dict[str, Optional[str]]: ...
|
||||
def _get_user_session_key(request: HttpRequest) -> int: ...
|
||||
def authenticate(request: Optional[HttpRequest] = ..., **credentials: Any) -> Optional[AbstractBaseUser]: ...
|
||||
def login(request: HttpRequest, user: User, backend: Optional[Union[str, Type[ModelBackend]]] = ...) -> None: ...
|
||||
def authenticate(
|
||||
request: Optional[HttpRequest] = ..., **credentials: Any
|
||||
) -> Optional[AbstractBaseUser]: ...
|
||||
def login(
|
||||
request: HttpRequest,
|
||||
user: User,
|
||||
backend: Optional[Union[str, Type[ModelBackend]]] = ...,
|
||||
) -> None: ...
|
||||
def logout(request: HttpRequest) -> None: ...
|
||||
def get_user_model() -> Type[Model]: ...
|
||||
def get_user(request: HttpRequest) -> Union[AnonymousUser, AbstractBaseUser]: ...
|
||||
|
||||
@@ -5,52 +5,28 @@ from django.forms.models import ModelMultipleChoiceField
|
||||
from django.http.response import HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.urls.resolvers import URLPattern
|
||||
from typing import (
|
||||
Dict,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
from typing import Dict, List, Tuple, Union
|
||||
|
||||
class GroupAdmin:
|
||||
def formfield_for_manytomany(
|
||||
self,
|
||||
db_field: ManyToManyField,
|
||||
request: WSGIRequest = ...,
|
||||
**kwargs
|
||||
self, db_field: ManyToManyField, request: WSGIRequest = ..., **kwargs
|
||||
) -> ModelMultipleChoiceField: ...
|
||||
|
||||
|
||||
class UserAdmin:
|
||||
def _add_view(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
form_url: str = ...,
|
||||
extra_context: None = ...
|
||||
self, request: WSGIRequest, form_url: str = ..., extra_context: None = ...
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
def add_view(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
form_url: str = ...,
|
||||
extra_context: None = ...
|
||||
self, request: WSGIRequest, form_url: str = ..., extra_context: None = ...
|
||||
): ...
|
||||
def get_fieldsets(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
obj: None = ...
|
||||
self, request: WSGIRequest, obj: None = ...
|
||||
) -> Tuple[Tuple[None, Dict[str, Union[Tuple[str], Tuple[str, str, str]]]]]: ...
|
||||
def get_urls(self) -> List[URLPattern]: ...
|
||||
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
|
||||
def response_add(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
obj: User,
|
||||
post_url_continue: None = ...
|
||||
self, request: WSGIRequest, obj: User, post_url_continue: None = ...
|
||||
) -> HttpResponseRedirect: ...
|
||||
def user_change_password(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
id: str,
|
||||
form_url: str = ...
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
self, request: WSGIRequest, id: str, form_url: str = ...
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.auth.models import (
|
||||
AnonymousUser,
|
||||
User,
|
||||
)
|
||||
from django.contrib.auth.models import AnonymousUser, User
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.query import QuerySet
|
||||
from django.http.request import HttpRequest
|
||||
from typing import (
|
||||
Optional,
|
||||
Set,
|
||||
Union,
|
||||
)
|
||||
|
||||
from typing import Optional, Set, Union
|
||||
|
||||
class AllowAllUsersModelBackend:
|
||||
def user_can_authenticate(self, user: User) -> bool: ...
|
||||
|
||||
|
||||
class AllowAllUsersRemoteUserBackend:
|
||||
def user_can_authenticate(self, user: User) -> bool: ...
|
||||
|
||||
|
||||
class ModelBackend:
|
||||
def _get_group_permissions(self, user_obj: User) -> QuerySet: ...
|
||||
def _get_permissions(self, user_obj: User, obj: None, from_name: str) -> Set[str]: ...
|
||||
@@ -30,31 +20,23 @@ class ModelBackend:
|
||||
request: Optional[HttpRequest],
|
||||
username: Optional[str] = ...,
|
||||
password: Optional[str] = ...,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
) -> Optional[User]: ...
|
||||
def get_all_permissions(self, user_obj: User, obj: Optional[str] = ...) -> Set[str]: ...
|
||||
def get_group_permissions(self, user_obj: User, obj: None = ...) -> Set[str]: ...
|
||||
def get_user(self, user_id: int) -> User: ...
|
||||
def get_user_permissions(self, user_obj: User, obj: None = ...) -> Set[str]: ...
|
||||
def has_module_perms(
|
||||
self,
|
||||
user_obj: Union[AnonymousUser, User],
|
||||
app_label: str
|
||||
self, user_obj: Union[AnonymousUser, User], app_label: str
|
||||
) -> bool: ...
|
||||
def has_perm(
|
||||
self,
|
||||
user_obj: Union[AnonymousUser, User],
|
||||
perm: str,
|
||||
obj: None = ...
|
||||
self, user_obj: Union[AnonymousUser, User], perm: str, obj: None = ...
|
||||
) -> bool: ...
|
||||
def user_can_authenticate(self, user: Optional[AbstractBaseUser]) -> bool: ...
|
||||
|
||||
|
||||
class RemoteUserBackend:
|
||||
def authenticate(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
remote_user: Optional[str]
|
||||
self, request: WSGIRequest, remote_user: Optional[str]
|
||||
) -> Optional[User]: ...
|
||||
def clean_username(self, username: str) -> str: ...
|
||||
def configure_user(self, user: User) -> User: ...
|
||||
def configure_user(self, user: User) -> User: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class AbstractBaseUser:
|
||||
def __str__(self) -> str: ...
|
||||
def check_password(self, raw_password: str) -> bool: ...
|
||||
@@ -20,8 +19,7 @@ class AbstractBaseUser:
|
||||
def set_password(self, raw_password: Optional[str]) -> None: ...
|
||||
def set_unusable_password(self) -> None: ...
|
||||
|
||||
|
||||
class BaseUserManager:
|
||||
def get_by_natural_key(self, username: Optional[str]) -> AbstractBaseUser: ...
|
||||
@classmethod
|
||||
def normalize_email(cls, email: Optional[str]) -> str: ...
|
||||
def normalize_email(cls, email: Optional[str]) -> str: ...
|
||||
|
||||
@@ -6,5 +6,6 @@ from .management import _get_builtin_permissions
|
||||
from typing import Any, Optional
|
||||
|
||||
from typing import Any, List
|
||||
|
||||
def check_user_model(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
||||
def check_models_permissions(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
||||
|
||||
@@ -7,6 +7,7 @@ from typing import Any
|
||||
from django.contrib.auth.models import AnonymousUser, User
|
||||
from django.http.request import HttpRequest
|
||||
from typing import Dict, Union
|
||||
|
||||
class PermLookupDict:
|
||||
def __init__(self, user: object, app_label: str) -> None: ...
|
||||
def __repr__(self): ...
|
||||
|
||||
@@ -5,6 +5,15 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
from typing import Callable, List, Optional, Union
|
||||
def user_passes_test(test_func: Callable, login_url: Optional[str] = ..., redirect_field_name: str = ...) -> Callable: ...
|
||||
def login_required(function: Optional[Callable] = ..., redirect_field_name: str = ..., login_url: None = ...) -> Callable: ...
|
||||
def permission_required(perm: Union[str, List[str]], login_url: None = ..., raise_exception: bool = ...) -> Callable: ...
|
||||
|
||||
def user_passes_test(
|
||||
test_func: Callable, login_url: Optional[str] = ..., redirect_field_name: str = ...
|
||||
) -> Callable: ...
|
||||
def login_required(
|
||||
function: Optional[Callable] = ...,
|
||||
redirect_field_name: str = ...,
|
||||
login_url: None = ...,
|
||||
) -> Callable: ...
|
||||
def permission_required(
|
||||
perm: Union[str, List[str]], login_url: None = ..., raise_exception: bool = ...
|
||||
) -> Callable: ...
|
||||
|
||||
@@ -2,15 +2,7 @@ from django.contrib.auth.models import User
|
||||
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
from typing import Any, Dict, Iterator, List, Optional, Union
|
||||
|
||||
class AdminPasswordChangeForm:
|
||||
def __init__(self, user: User, *args, **kwargs) -> None: ...
|
||||
@@ -19,7 +11,6 @@ class AdminPasswordChangeForm:
|
||||
def clean_password2(self) -> str: ...
|
||||
def save(self, commit: bool = ...) -> User: ...
|
||||
|
||||
|
||||
class AuthenticationForm:
|
||||
def __init__(self, request: object = ..., *args, **kwargs) -> None: ...
|
||||
def clean(self) -> Dict[str, str]: ...
|
||||
@@ -27,11 +18,9 @@ class AuthenticationForm:
|
||||
def get_invalid_login_error(self) -> ValidationError: ...
|
||||
def get_user(self) -> User: ...
|
||||
|
||||
|
||||
class PasswordChangeForm:
|
||||
def clean_old_password(self) -> str: ...
|
||||
|
||||
|
||||
class PasswordResetForm:
|
||||
def get_users(self, email: str) -> Iterator[Any]: ...
|
||||
def save(
|
||||
@@ -44,7 +33,7 @@ class PasswordResetForm:
|
||||
from_email: None = ...,
|
||||
request: Optional[WSGIRequest] = ...,
|
||||
html_email_template_name: None = ...,
|
||||
extra_email_context: Optional[Dict[str, str]] = ...
|
||||
extra_email_context: Optional[Dict[str, str]] = ...,
|
||||
) -> None: ...
|
||||
def send_mail(
|
||||
self,
|
||||
@@ -53,41 +42,34 @@ class PasswordResetForm:
|
||||
context: Dict[str, Union[str, User]],
|
||||
from_email: Optional[str],
|
||||
to_email: str,
|
||||
html_email_template_name: None = ...
|
||||
html_email_template_name: None = ...,
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class ReadOnlyPasswordHashField:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def has_changed(self, initial: str, data: None) -> bool: ...
|
||||
|
||||
|
||||
class ReadOnlyPasswordHashWidget:
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: str,
|
||||
attrs: Dict[str, str]
|
||||
) -> Dict[str, Union[Dict[str, Union[str, bool, Dict[str, str]]], List[Dict[str, str]]]]: ...
|
||||
|
||||
self, name: str, value: str, attrs: Dict[str, str]
|
||||
) -> Dict[
|
||||
str, Union[Dict[str, Union[str, bool, Dict[str, str]]], List[Dict[str, str]]]
|
||||
]: ...
|
||||
|
||||
class SetPasswordForm:
|
||||
def __init__(self, user: Optional[User], *args, **kwargs) -> None: ...
|
||||
def clean_new_password2(self) -> str: ...
|
||||
def save(self, commit: bool = ...) -> User: ...
|
||||
|
||||
|
||||
class UserChangeForm:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def clean_password(self) -> str: ...
|
||||
|
||||
|
||||
class UserCreationForm:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def _post_clean(self) -> None: ...
|
||||
def clean_password2(self) -> str: ...
|
||||
def save(self, commit: bool = ...) -> User: ...
|
||||
|
||||
|
||||
class UsernameField:
|
||||
def to_python(self, value: Optional[str]) -> str: ...
|
||||
def to_python(self, value: Optional[str]) -> str: ...
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
)
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
def check_password(environ: Dict[Any, Any], username: str, password: str): ...
|
||||
|
||||
|
||||
def groups_for_user(environ: Dict[Any, Any], username: str): ...
|
||||
def groups_for_user(environ: Dict[Any, Any], username: str): ...
|
||||
|
||||
@@ -6,13 +6,23 @@ from typing import Any, Optional
|
||||
|
||||
from collections import OrderedDict
|
||||
from typing import Callable, Dict, List, Optional, Union
|
||||
|
||||
UNUSABLE_PASSWORD_PREFIX: str
|
||||
UNUSABLE_PASSWORD_SUFFIX_LENGTH: int
|
||||
|
||||
def is_password_usable(encoded: Optional[str]) -> bool: ...
|
||||
def check_password(password: str, encoded: str, setter: Optional[Callable] = ..., preferred: str = ...) -> bool: ...
|
||||
def make_password(password: Optional[str], salt: Optional[str] = ..., hasher: str = ...) -> str: ...
|
||||
def get_hashers() -> Union[List[UnsaltedMD5PasswordHasher], List[MD5PasswordHasher], List[BasePasswordHasher], List[PBKDF2PasswordHasher]]: ...
|
||||
def check_password(
|
||||
password: str, encoded: str, setter: Optional[Callable] = ..., preferred: str = ...
|
||||
) -> bool: ...
|
||||
def make_password(
|
||||
password: Optional[str], salt: Optional[str] = ..., hasher: str = ...
|
||||
) -> str: ...
|
||||
def get_hashers() -> Union[
|
||||
List[UnsaltedMD5PasswordHasher],
|
||||
List[MD5PasswordHasher],
|
||||
List[BasePasswordHasher],
|
||||
List[PBKDF2PasswordHasher],
|
||||
]: ...
|
||||
def get_hashers_by_algorithm() -> Dict[str, BasePasswordHasher]: ...
|
||||
def reset_hashers(**kwargs: Any) -> None: ...
|
||||
def get_hasher(algorithm: str = ...) -> BasePasswordHasher: ...
|
||||
|
||||
@@ -8,8 +8,16 @@ from django.apps.config import AppConfig
|
||||
from django.apps.registry import Apps
|
||||
from django.db.models.options import Options
|
||||
from typing import List, Tuple
|
||||
|
||||
def _get_all_permissions(opts: Options) -> List[Tuple[str, str]]: ...
|
||||
def _get_builtin_permissions(opts: Options) -> List[Tuple[str, str]]: ...
|
||||
def create_permissions(app_config: AppConfig, verbosity: int = ..., interactive: bool = ..., using: str = ..., apps: Apps = ..., **kwargs: Any) -> None: ...
|
||||
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 = ...) -> str: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from django.core.management.base import CommandParser
|
||||
|
||||
|
||||
class Command:
|
||||
def add_arguments(self, parser: CommandParser) -> None: ...
|
||||
def handle(self, *args, **options) -> str: ...
|
||||
def handle(self, *args, **options) -> str: ...
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
from django.core.management.base import CommandParser
|
||||
from django.db.models.fields import CharField
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
from typing import (
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
from typing import Optional, Union
|
||||
|
||||
class Command:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
@@ -15,6 +11,6 @@ class Command:
|
||||
self,
|
||||
field: Union[CharField, related.ForeignKey],
|
||||
message: str,
|
||||
default: Optional[str] = ...
|
||||
default: Optional[str] = ...,
|
||||
) -> Optional[str]: ...
|
||||
def handle(self, *args, **options) -> None: ...
|
||||
def handle(self, *args, **options) -> None: ...
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
from django.contrib.auth.models import (
|
||||
AnonymousUser,
|
||||
User,
|
||||
)
|
||||
from django.contrib.auth.models import AnonymousUser, User
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from typing import Union
|
||||
|
||||
|
||||
def get_user(
|
||||
request: HttpRequest
|
||||
) -> Union[AnonymousUser, User]: ...
|
||||
|
||||
def get_user(request: HttpRequest) -> Union[AnonymousUser, User]: ...
|
||||
|
||||
class AuthenticationMiddleware:
|
||||
def process_request(self, request: HttpRequest) -> None: ...
|
||||
|
||||
|
||||
class RemoteUserMiddleware:
|
||||
def _remove_invalid_user(self, request: WSGIRequest) -> None: ...
|
||||
def clean_username(self, username: str, request: WSGIRequest) -> str: ...
|
||||
def process_request(self, request: WSGIRequest) -> None: ...
|
||||
def process_request(self, request: WSGIRequest) -> None: ...
|
||||
|
||||
@@ -1,30 +1,18 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import HttpResponse
|
||||
from typing import (
|
||||
Callable,
|
||||
List,
|
||||
)
|
||||
|
||||
from typing import Callable, List
|
||||
|
||||
class AccessMixin:
|
||||
def get_permission_denied_message(self) -> str: ...
|
||||
def get_redirect_field_name(self) -> str: ...
|
||||
def handle_no_permission(self): ...
|
||||
|
||||
|
||||
class LoginRequiredMixin:
|
||||
def dispatch(self, request: WSGIRequest, *args, **kwargs): ...
|
||||
|
||||
|
||||
class PermissionRequiredMixin:
|
||||
def dispatch(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> HttpResponse: ...
|
||||
def dispatch(self, request: WSGIRequest, *args, **kwargs) -> HttpResponse: ...
|
||||
def get_permission_required(self) -> List[str]: ...
|
||||
|
||||
|
||||
class UserPassesTestMixin:
|
||||
def get_test_func(self) -> Callable: ...
|
||||
def get_test_func(self) -> Callable: ...
|
||||
|
||||
@@ -1,98 +1,65 @@
|
||||
from typing import (
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
from typing import List, Optional, Set, Tuple, Type, Union
|
||||
|
||||
def _user_get_all_permissions(user: User, obj: Optional[str]) -> Set[str]: ...
|
||||
|
||||
|
||||
def _user_has_module_perms(
|
||||
user: Union[AnonymousUser, User],
|
||||
app_label: str
|
||||
) -> bool: ...
|
||||
|
||||
|
||||
def _user_has_module_perms(user: Union[AnonymousUser, User], app_label: str) -> bool: ...
|
||||
def _user_has_perm(
|
||||
user: Union[AnonymousUser, User],
|
||||
perm: str,
|
||||
obj: Optional[str]
|
||||
user: Union[AnonymousUser, User], perm: str, obj: Optional[str]
|
||||
) -> bool: ...
|
||||
|
||||
|
||||
def update_last_login(
|
||||
sender: Type[User],
|
||||
user: User,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
|
||||
def update_last_login(sender: Type[User], user: User, **kwargs) -> None: ...
|
||||
|
||||
class AbstractUser:
|
||||
def clean(self) -> None: ...
|
||||
def get_short_name(self) -> str: ...
|
||||
|
||||
|
||||
class AnonymousUser:
|
||||
def __str__(self) -> str: ...
|
||||
def delete(self): ...
|
||||
def get_username(self) -> str: ...
|
||||
def has_module_perms(self, module: str) -> bool: ...
|
||||
def has_perm(self, perm: str, obj: None = ...) -> bool: ...
|
||||
def has_perms(self, perm_list: Union[List[str], Tuple[str]], obj: None = ...) -> bool: ...
|
||||
def has_perms(
|
||||
self, perm_list: Union[List[str], Tuple[str]], obj: None = ...
|
||||
) -> bool: ...
|
||||
@property
|
||||
def is_anonymous(self) -> bool: ...
|
||||
@property
|
||||
def is_authenticated(self) -> bool: ...
|
||||
def set_password(self, raw_password: str): ...
|
||||
|
||||
|
||||
class Group:
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
|
||||
class GroupManager:
|
||||
def get_by_natural_key(self, name: str) -> Group: ...
|
||||
|
||||
|
||||
class Permission:
|
||||
def __str__(self) -> str: ...
|
||||
def natural_key(self) -> Tuple[str, str, str]: ...
|
||||
|
||||
|
||||
class PermissionManager:
|
||||
def get_by_natural_key(self, codename: str, app_label: str, model: str) -> Permission: ...
|
||||
|
||||
def get_by_natural_key(
|
||||
self, codename: str, app_label: str, model: str
|
||||
) -> Permission: ...
|
||||
|
||||
class PermissionsMixin:
|
||||
def get_all_permissions(self, obj: None = ...) -> Set[str]: ...
|
||||
def has_module_perms(self, app_label: str) -> bool: ...
|
||||
def has_perm(self, perm: str, obj: None = ...) -> bool: ...
|
||||
def has_perms(self, perm_list: Union[List[str], Tuple[str]], obj: None = ...) -> bool: ...
|
||||
|
||||
def has_perms(
|
||||
self, perm_list: Union[List[str], Tuple[str]], obj: None = ...
|
||||
) -> bool: ...
|
||||
|
||||
class UserManager:
|
||||
def _create_user(
|
||||
self,
|
||||
username: str,
|
||||
email: Optional[str],
|
||||
password: Optional[str],
|
||||
**extra_fields
|
||||
self, username: str, email: Optional[str], password: Optional[str], **extra_fields
|
||||
) -> User: ...
|
||||
def create_superuser(
|
||||
self,
|
||||
username: str,
|
||||
email: str,
|
||||
password: Optional[str],
|
||||
**extra_fields
|
||||
self, username: str, email: str, password: Optional[str], **extra_fields
|
||||
) -> User: ...
|
||||
def create_user(
|
||||
self,
|
||||
username: str,
|
||||
email: Optional[str] = ...,
|
||||
password: Optional[str] = ...,
|
||||
**extra_fields
|
||||
) -> User: ...
|
||||
**extra_fields,
|
||||
) -> User: ...
|
||||
|
||||
@@ -8,10 +8,19 @@ from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.auth.models import User
|
||||
from pathlib import PosixPath
|
||||
from typing import Dict, List, Optional, Tuple, Union
|
||||
def get_default_password_validators() -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
||||
def get_password_validators(validator_config: List[Dict[str, str]]) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
||||
def validate_password(password: str, user: Optional[User] = ..., password_validators: None = ...) -> None: ...
|
||||
def password_changed(password: str, user: AbstractBaseUser = ..., password_validators: None = ...) -> None: ...
|
||||
|
||||
def get_default_password_validators() -> Union[
|
||||
List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]
|
||||
]: ...
|
||||
def get_password_validators(
|
||||
validator_config: List[Dict[str, str]]
|
||||
) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
||||
def validate_password(
|
||||
password: str, user: Optional[User] = ..., password_validators: None = ...
|
||||
) -> None: ...
|
||||
def password_changed(
|
||||
password: str, user: AbstractBaseUser = ..., password_validators: None = ...
|
||||
) -> None: ...
|
||||
def password_validators_help_texts(password_validators: None = ...) -> List[str]: ...
|
||||
def _password_validators_help_text_html(password_validators: None = ...) -> str: ...
|
||||
|
||||
@@ -27,7 +36,9 @@ class UserAttributeSimilarityValidator:
|
||||
DEFAULT_USER_ATTRIBUTES: Any = ...
|
||||
user_attributes: Any = ...
|
||||
max_similarity: Any = ...
|
||||
def __init__(self, user_attributes: Tuple[str, str, str, str] = ..., max_similarity: float = ...) -> None: ...
|
||||
def __init__(
|
||||
self, user_attributes: Tuple[str, str, str, str] = ..., max_similarity: float = ...
|
||||
) -> None: ...
|
||||
def validate(self, password: str, user: None = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ from typing import Any
|
||||
from datetime import date
|
||||
from django.contrib.auth.models import User
|
||||
from typing import Optional
|
||||
|
||||
class PasswordResetTokenGenerator:
|
||||
key_salt: str = ...
|
||||
secret: Any = ...
|
||||
|
||||
@@ -10,34 +10,17 @@ from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Optional,
|
||||
Set,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
from typing import Any, Dict, Optional, Set, Type, Union
|
||||
|
||||
def redirect_to_login(
|
||||
next: str,
|
||||
login_url: Optional[str] = ...,
|
||||
redirect_field_name: Optional[str] = ...
|
||||
next: str, login_url: Optional[str] = ..., redirect_field_name: Optional[str] = ...
|
||||
) -> HttpResponseRedirect: ...
|
||||
|
||||
|
||||
class LoginView:
|
||||
def dispatch(
|
||||
self,
|
||||
request: HttpRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
self, request: HttpRequest, *args, **kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
def form_valid(
|
||||
self,
|
||||
form: AuthenticationForm
|
||||
) -> HttpResponseRedirect: ...
|
||||
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
|
||||
def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
|
||||
def get_form_class(self) -> Type[AuthenticationForm]: ...
|
||||
def get_form_kwargs(
|
||||
@@ -46,63 +29,36 @@ class LoginView:
|
||||
def get_redirect_url(self) -> str: ...
|
||||
def get_success_url(self) -> str: ...
|
||||
|
||||
|
||||
class LogoutView:
|
||||
def dispatch(
|
||||
self,
|
||||
request: HttpRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
self, request: HttpRequest, *args, **kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
def get_next_page(self) -> Optional[str]: ...
|
||||
def post(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> TemplateResponse: ...
|
||||
|
||||
def post(self, request: WSGIRequest, *args, **kwargs) -> TemplateResponse: ...
|
||||
|
||||
class PasswordChangeDoneView:
|
||||
def dispatch(self, *args, **kwargs) -> TemplateResponse: ...
|
||||
|
||||
|
||||
class PasswordChangeView:
|
||||
def dispatch(
|
||||
self,
|
||||
*args,
|
||||
**kwargs
|
||||
self, *args, **kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
def form_valid(
|
||||
self,
|
||||
form: PasswordChangeForm
|
||||
) -> HttpResponseRedirect: ...
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[str, Optional[Union[MultiValueDict, User]]]: ...
|
||||
|
||||
def form_valid(self, form: PasswordChangeForm) -> HttpResponseRedirect: ...
|
||||
def get_form_kwargs(self) -> Dict[str, Optional[Union[MultiValueDict, User]]]: ...
|
||||
|
||||
class PasswordResetConfirmView:
|
||||
def dispatch(
|
||||
self,
|
||||
*args,
|
||||
**kwargs
|
||||
self, *args, **kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[str, Optional[Union[MultiValueDict, User]]]: ...
|
||||
def get_form_kwargs(self) -> Dict[str, Optional[Union[MultiValueDict, User]]]: ...
|
||||
def get_user(self, uidb64: str) -> Optional[User]: ...
|
||||
|
||||
|
||||
class PasswordResetView:
|
||||
def dispatch(
|
||||
self,
|
||||
*args,
|
||||
**kwargs
|
||||
self, *args, **kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
def form_valid(self, form: PasswordResetForm) -> HttpResponseRedirect: ...
|
||||
|
||||
|
||||
class SuccessURLAllowedHostsMixin:
|
||||
def get_success_url_allowed_hosts(self) -> Set[str]: ...
|
||||
def get_success_url_allowed_hosts(self) -> Set[str]: ...
|
||||
|
||||
Reference in New Issue
Block a user