summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authormariatta <mariatta.wijaya@gmail.com>2026-04-03 11:44:02 -0700
committerJacob Walls <jacobtylerwalls@gmail.com>2026-04-07 15:38:35 -0400
commite2abe321a6f1370e05c1a89a742125c9eafcac8c (patch)
tree85bd11175bfa5e3e3cc9e7ccbb9c3af31cc37f4e /django
parent74e73dc1315d696330621a7f08310a2e87ea0eba (diff)
Fixed #37021 -- Added Permission.user_perm_str property.
For use in checking user permissions via has_perm(). Co-authored-by: 사재혁 <jaehyuck.sa.dev@gmail.com>
Diffstat (limited to 'django')
-rw-r--r--django/contrib/auth/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py
index 7b7dee78fc..f41ece7ce8 100644
--- a/django/contrib/auth/models.py
+++ b/django/contrib/auth/models.py
@@ -79,6 +79,11 @@ class Permission(models.Model):
def __str__(self):
return "%s | %s" % (self.content_type, self.name)
+ @property
+ def user_perm_str(self):
+ """String representation for the user permission check."""
+ return f"{self.content_type.app_label}.{self.codename}"
+
def natural_key(self):
return (self.codename, *self.content_type.natural_key())