django-clearance: row-level access control, managed in the admin site

I have been building django-clearance, an access-control library for
Django, and it has reached the point where I would like other eyes on it.

Django’s permissions answer “may this person change orders?”. Most projects
also need to know which orders (a branch manager edits their branch’s),
which fields (a manager reads the order but not the price) and which
values
(anybody who edits an order may fix its item, but only whoever may
approve sets it to approved). Written in the views, each answer is repeated
in every view, the API and the admin - and the one that is forgotten shows
too much, with nothing failing.

django-clearance answers each once:

  • Scopes: a permission is given with a scope - “their own”, “their
    branch’s”, or a rule an administrator builds in the admin site with no code
    (status is one of pending, approved). A scope becomes one filter, so a
    list costs one query.
  • Protected fields, read with one permission and written with another.
  • Status actions: only whoever holds approve writes approved.
  • Roles, optional, with a ceiling.

It keeps Django’s own tables - groups are bundles, user.has_perm() still
works - and it is denied by default: a permission with no scope reaches
no rows, and a view that cannot say which policy to ask is refused at
start-up. Changes go through safety rules, so nobody who manages access can
give themselves more.

It is alpha (0.2), tested on Python 3.11-3.14 and Django 5.2-6.1. I would be
grateful for feedback - especially on the API, and on cases it does not
cover yet.