Skip to content

Commit 311e4e6

Browse files
committed
Replace str with _StrOrPromise where the latter is expected.
Fixes typeddjango#1231 Signed-off-by: Zixuan James Li <[email protected]>
1 parent f4cf7f2 commit 311e4e6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

django-stubs/contrib/auth/mixins.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ from typing import Any, Callable, Optional, Sequence
22

33
from django import http
44
from django.http.response import HttpResponseBase, HttpResponseRedirect
5+
from django.utils.functional import _StrOrPromise
56

67
class AccessMixin:
78
login_url: Any = ...
8-
permission_denied_message: str = ...
9+
permission_denied_message: _StrOrPromise = ...
910
raise_exception: bool = ...
1011
redirect_field_name: Any = ...
1112
def get_login_url(self) -> str: ...
12-
def get_permission_denied_message(self) -> str: ...
13+
def get_permission_denied_message(self) -> _StrOrPromise: ...
1314
def get_redirect_field_name(self) -> str: ...
1415
def handle_no_permission(self) -> HttpResponseRedirect: ...
1516

django-stubs/contrib/messages/views.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ from typing import Dict
22

33
from django.forms.forms import BaseForm
44
from django.http.response import HttpResponse
5+
from django.utils.functional import _StrOrPromise
56

67
class SuccessMessageMixin:
7-
success_message: str = ...
8+
success_message: _StrOrPromise = ...
89
def form_valid(self, form: BaseForm) -> HttpResponse: ...
9-
def get_success_message(self, cleaned_data: Dict[str, str]) -> str: ...
10+
def get_success_message(self, cleaned_data: Dict[str, str]) -> _StrOrPromise: ...

0 commit comments

Comments
 (0)