djangorestframework-role-filters
django-rest-framework-role-filters
Decision gist · record as of 2026-08-14
Yes, if you are building a Django REST Framework API with role-based access control and want to avoid scattered permission checks. The package is stable, has low install friction, and carries no known vulnerabilities. The main caveat is dormant maintenance—last updated 2023-10-06—so if you need active support or compatibility with very recent Django/DRF versions, verify compatibility first. For established projects with stable dependencies, this is a solid choice.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with only djangorestframework as a runtime dependency.
- Maintenance is dormant—last commit was 2023-10-06—but the package is marked Production/Stable and has seen no recent changes needed.
License · maintenance · safety
permissive license (permissive) — MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2023-10-06 (1043 days) · last repo commit 2023-10-06 · 97 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 867,136 downloads/mo, #4,858 on PyPI
Alternatives
Verify before relying
pip install djangorestframework-role-filters
from djangorestframework_role_filters.role_filters import RoleFilter
from djangorestframework_role_filters.viewsets import RoleFilterModelViewSet
class UserRoleFilter(RoleFilter):
role_id = 'user'
def get_allowed_actions(self, request, view, obj=None):
return ['list', 'retrieve']
class MyViewSet(RoleFilterModelViewSet):
role_filter_classes = [UserRoleFilter]
def get_role_id(self, request):
return request.user.role.role_id- Whether the package works with current versions of Django and djangorestframework (last tested against versions unspecified)
- Performance characteristics when handling many role filters or complex permission logic
- Whether dormant maintenance status means security patches or bug fixes are unlikely if issues arise
What it is and what it does
This package extends Django REST Framework with a role-based filtering system that lets you define different access rules per user role in a declarative way. Instead of writing multiple conditional checks throughout your viewset code, you create role filter classes that specify which actions are allowed, how to filter the queryset, which serializer to use, and how to configure it—then attach them to your viewset. The framework automatically applies the right rules based on the user's role.
You define role filters by subclassing RoleFilter and setting a role_id, then implement methods like get_allowed_actions(), get_queryset(), get_serializer_class(), and get_serializer() to customize behavior per role. Your viewset inherits from RoleFilterModelViewSet and implements get_role_id() to determine the current user's role. The package handles permission checks and queryset/serializer selection automatically, keeping your view code clean and your role logic centralized.
Use it for
- Multi-tenant SaaS where admins see all data but regular users see only their own records
- API with tiered access levels requiring different allowed actions per tier
- REST API where different roles need different serializer fields exposed to each role
- Reducing permission-check boilerplate in viewsets by centralizing role logic in filter classes
- Filtering querysets dynamically based on user role without writing conditional logic in each view
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are building a Django REST Framework API with role-based access control and want to avoid scattered permission checks.
The package is stable, has low install friction, and carries no known vulnerabilities. The main caveat is dormant maintenance—last updated 2023-10-06—so if you need active support or compatibility with very recent Django/DRF versions, verify compatibility first. For established projects with stable dependencies, this is a solid choice.
Install
djangorestframework-role-filters on PyPI
Before you install
Low friction: pure Python wheel with only djangorestframework as a runtime dependency. Maintenance is dormant—last commit was 2023-10-06—but the package is marked Production/Stable and has seen no recent changes needed.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install djangorestframework-role-filters
from djangorestframework_role_filters.role_filters import RoleFilter
from djangorestframework_role_filters.viewsets import RoleFilterModelViewSet
class UserRoleFilter(RoleFilter):
role_id = 'user'
def get_allowed_actions(self, request, view, obj=None):
return ['list', 'retrieve']
class MyViewSet(RoleFilterModelViewSet):
role_filter_classes = [UserRoleFilter]
def get_role_id(self, request):
return request.user.role.role_id
Verify before relying
- Whether the package works with current versions of Django and djangorestframework (last tested against versions unspecified)
- Performance characteristics when handling many role filters or complex permission logic
- Whether dormant maintenance status means security patches or bug fixes are unlikely if issues arise
Package facts
| License | permissive license permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagedjangorestframework |
| Maintenance | Dormant 1,043 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 867,136 / month, #4,858 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python Modules |
Evidence: djangorestframework_role_filters-1.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django rest framework role permissions”
- djangorestframework-role-filtersAdds role-based access control to Django REST Framework viewsets,…
- dry-rest-permissionsDefines rules-based permissions for Django REST Framework APIs by…
- djangorestframework-guardianIntegrates django-guardian's object-level permissions into Django…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also drf-access-policy · dry-rest-permissions · django-prbac · adrf · django-zen-queries · bridgekeeper · djangorestframework-guardian · drf-nested-routers · djangorestframework · djangorestframework-filters