From 0117348c3c7713f25f96b46e53ebdeed7bdba544 Mon Sep 17 00:00:00 2001 From: Dan Groshev Date: Wed, 23 Aug 2023 16:13:25 +0100 Subject: [PATCH] Rename SuccessURLAllowedHostsMixin to RedirectURLMixin and hint missing attributes (#1641) Remove SuccessURLAllowedHostsMixin and replace it with RedirectURLMixin Per Django 4.1 release notes (https://docs.djangoproject.com/en/4.2/releases/4.1/#miscellaneous): "The undocumented django.contrib.auth.views.SuccessURLAllowedHostsMixin mixin is replaced by RedirectURLMixin." --- django-stubs/contrib/auth/views.pyi | 13 +++++++++---- scripts/stubtest/allowlist_todo.txt | 4 ---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/django-stubs/contrib/auth/views.pyi b/django-stubs/contrib/auth/views.pyi index b669fcf13..8992d334a 100644 --- a/django-stubs/contrib/auth/views.pyi +++ b/django-stubs/contrib/auth/views.pyi @@ -9,18 +9,23 @@ from django.views.generic.edit import FormView UserModel: Any -class SuccessURLAllowedHostsMixin: - success_url_allowed_hosts: 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(SuccessURLAllowedHostsMixin, FormView[AuthenticationForm]): +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(SuccessURLAllowedHostsMixin, TemplateView): +class LogoutView(RedirectURLMixin, TemplateView): next_page: str | None redirect_field_name: str extra_context: Any diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index 48b1268b7..ed9247434 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -237,14 +237,10 @@ django.contrib.auth.validators.UnicodeUsernameValidator.__new__ django.contrib.auth.validators.UnicodeUsernameValidator.deconstruct django.contrib.auth.views.INTERNAL_RESET_URL_TOKEN django.contrib.auth.views.LoginView.form_class -django.contrib.auth.views.LoginView.get_default_redirect_url -django.contrib.auth.views.LogoutView.get_default_redirect_url django.contrib.auth.views.LogoutView.get_next_page django.contrib.auth.views.PasswordChangeView.form_class django.contrib.auth.views.PasswordResetConfirmView.form_class django.contrib.auth.views.PasswordResetView.form_class -django.contrib.auth.views.RedirectURLMixin -django.contrib.auth.views.SuccessURLAllowedHostsMixin django.contrib.contenttypes.admin.GenericInlineModelAdmin django.contrib.contenttypes.admin.GenericInlineModelAdmin.ct_field django.contrib.contenttypes.admin.GenericInlineModelAdmin.ct_fk_field