From a650f9b5e98289a5a6bf034d8902eaea8b72e598 Mon Sep 17 00:00:00 2001 From: Lorenzo Guideri <78531018+LorenzoGuideri@users.noreply.github.com> Date: Fri, 23 Jan 2026 10:48:23 +0100 Subject: [PATCH 1/2] Enhance permissions documentation with grouping and precedence Expanded explanation of permission composition to include grouping and operator precedence. --- docs/api-guide/permissions.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index b8179490ee..8d37fd1a11 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -138,7 +138,9 @@ Provided they inherit from `rest_framework.permissions.BasePermission`, permissi return Response(content) !!! note - Composition of permissions supports `&` (and), `|` (or) and `~` (not) operators. + Composition of permissions supports the `&` (and), `|` (or) and `~` (not) operators, and also allows the use of brackets `(` `)` to group expressions. + Operators follow the same precedence and associativity rules as standard logical operators (`~` highest, then `&`, then `|`). + # API Reference From e1b4faa125da6576f34df3b1fde5b9980d946b5b Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sat, 24 Jan 2026 14:28:28 +0000 Subject: [PATCH 2/2] Tweak formatting --- docs/api-guide/permissions.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index 8d37fd1a11..8acbdf77d1 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -138,7 +138,8 @@ Provided they inherit from `rest_framework.permissions.BasePermission`, permissi return Response(content) !!! note - Composition of permissions supports the `&` (and), `|` (or) and `~` (not) operators, and also allows the use of brackets `(` `)` to group expressions. + Composition of permissions supports the `&` (and), `|` (or) and `~` (not) operators, and also allows the use of brackets `(` `)` to group expressions. + Operators follow the same precedence and associativity rules as standard logical operators (`~` highest, then `&`, then `|`).