Skip to content

Commit

Permalink
Fix staff_member_required annotations (typeddjango#436)
Browse files Browse the repository at this point in the history
* Fix staff_member_required annotations

`redirect_field_name` can be `None`.

* Reformat code with black
  • Loading branch information
sirex authored Jul 31, 2020
1 parent f651f27 commit ca10ee9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions django-stubs/contrib/admin/views/decorators.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from typing import Callable, TypeVar, overload
from typing import Callable, Optional, TypeVar, overload

_C = TypeVar("_C", bound=Callable)
@overload
def staff_member_required(view_func: _C = ..., redirect_field_name: str = ..., login_url: str = ...) -> _C: ...
def staff_member_required(
view_func: _C = ..., redirect_field_name: Optional[str] = ..., login_url: str = ...
) -> _C: ...
@overload
def staff_member_required(view_func: None = ..., redirect_field_name: str = ..., login_url: str = ...) -> Callable: ...
def staff_member_required(
view_func: None = ..., redirect_field_name: Optional[str] = ..., login_url: str = ...
) -> Callable: ...

0 comments on commit ca10ee9

Please sign in to comment.