Skip to content

Add more types#2170

Merged
alastair merged 5 commits into
masterfrom
add-more-types
Jul 21, 2026
Merged

Add more types#2170
alastair merged 5 commits into
masterfrom
add-more-types

Conversation

@alastair

Copy link
Copy Markdown
Member

Issue(s)

Description

Deployment steps:

alastair added 5 commits July 21, 2026 10:42
Replace the inline user_passes_test(lambda u: u.is_staff) with a
module-level user_is_staff predicate. django-stubs types the callable's
argument as AbstractBaseUser | AnonymousUser, and AbstractBaseUser has
no is_staff attribute, so mypy could not check the lambda. The predicate
takes that same union and narrows to User before reading is_staff.
Behaviour is unchanged (AnonymousUser.is_staff is already False).
@alastair
alastair merged commit 687d465 into master Jul 21, 2026
3 checks passed
@alastair
alastair deleted the add-more-types branch July 21, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant