Permission Manager for django rest framework
Use permission_manager for django rest framework.
Full documentation on read the docs.
Install
pip install permission-manager-drf
Example
from django.db import models
from rest_framework.permissions import IsAuthenticated
from rest_framework.viewsets import ModelViewSet
from rest_framework.decorators import action
from permission_manager_drf import DRFPermissionManager, ManagerPermission
from permission_manager import PermissionResult
# Define permission manager
class SomeModelPermissionManager(DRFPermissionManager):
def has_create_permission(self) -> bool:
return self.user.is_staff
def has_update_permission(self) -> bool:
return self.user.is_staff
def has_delete_permission(self) -> bool:
return self.user.is_staff
def has_view_permission(self) -> bool:
return True
def has_list_permission(self) -> bool:
return True
def has_custom_permission(self) -> bool:
return PermissionResult(
message="You can't do it",
value=self.user.is_staff,
)
# Define model with permission manager attribute
class SomeModel(models.Model):
permission_manager = SomeModelPermissionManager
...
# ViewSet
class TestModelViewSet(ModelViewSet):
permission_classes = [IsAuthenticated, ManagerPermission]
...
@action(detail=True)
def custom(self, request, **kwargs):
...
That's all. Now every drf action will be checked by the permission manager.
Also, you can use the serializer field for retrieve permissions you need.
from permission_manager_drf import PermissionField
from rest_framework.serializers import ModelSerializer
class SomeModelSerializer(ModelSerializer):
permissions = PermissionField(actions=('view', 'custom'),)
...
"""
Example output:
{
...,
'permissions': {
'view': {
'allow': True,
'messages': None,
},
'custom': {
'allow': False,
'messages': ["You can't do it"],
},
}
}
"""
Metadata
Release files for permission-manager-drf 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| permission_manager_drf-1.0.1.tar.gz | 50.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| permission_manager_drf-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 58.8 kB
Release files / permission_manager_drf-1.0.1.tar.gz
| Download URL | permission_manager_drf-1.0.1.tar.gz |
|---|---|
| Size | 50.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f547749d7ddfe91c48edba53aa42dfea3304e63eb1e22fb5a86dc059d8416bf1
|
|
BLAKE2b-256 checksum How to use checksums |
ea01c9a21e29e567d2bbcb1dd3f29a77dd35272cddf113684da11277149ac666
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 15, 2026.
Transparency logRelease files / permission_manager_drf-1.0.1-py3-none-any.whl
| Download URL | permission_manager_drf-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3539d5bcabb7a31b1a5f19d04a999a15fda31eb9d8edd0ac23844831e5d16ee4
|
|
BLAKE2b-256 checksum How to use checksums |
c8bfdb5016444cad96078e6da6d79523a0d89b7a0b0a0d6b5e1c919d9b003f2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 15, 2026.
Transparency log