summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorHarsh Jain <131331439+Hj-codes@users.noreply.github.com>2025-11-06 03:26:15 +0530
committerGitHub <noreply@github.com>2025-11-05 16:56:15 -0500
commitdfcc662cf8fd7f897ddcdfeaf5cb4ae6c963ebf8 (patch)
treea707fecd5c6d5c47bd1076a946e37391682d5899 /django
parentc5a107e8248813f07325ae65232b5e53e9ac4238 (diff)
Fixed #36709 -- Included static methods in system check for UserModel.is_anonymous/is_authenticated methods.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/auth/checks.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/django/contrib/auth/checks.py b/django/contrib/auth/checks.py
index cf23c51746..0de4cf49f1 100644
--- a/django/contrib/auth/checks.py
+++ b/django/contrib/auth/checks.py
@@ -1,5 +1,4 @@
from itertools import chain
-from types import MethodType
from django.apps import apps
from django.conf import settings
@@ -98,7 +97,7 @@ def check_user_model(app_configs, **kwargs):
)
)
- if isinstance(cls().is_anonymous, MethodType):
+ if callable(cls().is_anonymous):
errors.append(
checks.Critical(
"%s.is_anonymous must be an attribute or property rather than "
@@ -108,7 +107,7 @@ def check_user_model(app_configs, **kwargs):
id="auth.C009",
)
)
- if isinstance(cls().is_authenticated, MethodType):
+ if callable(cls().is_authenticated):
errors.append(
checks.Critical(
"%s.is_authenticated must be an attribute or property rather "