Dead simple Django REST API generator with role-based permissions
Project description
TurboDRF
Dead simple Django REST Framework API generator with role-based permissions.
Turn your Django models into fully-featured REST APIs with a mixin and a method. Zero boilerplate.
Install
pip install turbodrf
Quick Start
1. Add to settings:
INSTALLED_APPS = [
'rest_framework',
'turbodrf',
]
2. Add the mixin to your model:
from django.db import models
from turbodrf.mixins import TurboDRFMixin
class Book(models.Model, TurboDRFMixin):
title = models.CharField(max_length=200)
author = models.ForeignKey(Author, on_delete=models.CASCADE)
price = models.DecimalField(max_digits=10, decimal_places=2)
searchable_fields = ['title']
@classmethod
def turbodrf(cls):
return {
'fields': {
'list': ['title', 'author__name', 'price'],
'detail': ['title', 'author__name', 'author__email', 'price']
}
}
3. Add the router:
from turbodrf.router import TurboDRFRouter
router = TurboDRFRouter()
urlpatterns = [
path('api/', include(router.urls)),
]
Done. You now have a full REST API with search, filtering, pagination, and field selection:
GET /api/books/ # List
GET /api/books/1/ # Detail
POST /api/books/ # Create
PUT /api/books/1/ # Update
DELETE /api/books/1/ # Delete
GET /api/books/?search=django # Search
GET /api/books/?price__lt=20 # Filter
GET /api/books/?fields=title,price # Select fields
Documentation
- Configuration -- all
turbodrf()options, field selection, nested fields - Permissions -- role-based, field-level, and Django default permissions
- Performance -- compiled read path, fast JSON rendering, benchmarking
- Filtering & Search -- filtering, search, ordering, OR queries
- Integrations -- allauth, Keycloak, drf-api-tracking
- Security -- sensitive fields, secure defaults, error responses
- Management Commands -- turbodrf_check, turbodrf_benchmark, turbodrf_explain
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file turbodrf-0.3.0.tar.gz.
File metadata
- Download URL: turbodrf-0.3.0.tar.gz
- Upload date:
- Size: 118.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5006a0fcef14844fe24268a2cbccecd87779351ff1785d34a796060139518c4d
|
|
| MD5 |
f14c388a2404ead515ea17d1f51040bc
|
|
| BLAKE2b-256 |
b1af633d3e42db35aced2537621795262438bbe2d0f25b47960de0bf766603a7
|
Provenance
The following attestation bundles were made for turbodrf-0.3.0.tar.gz:
Publisher:
publish.yml on AlexanderCollins/TurboDRF
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turbodrf-0.3.0.tar.gz -
Subject digest:
5006a0fcef14844fe24268a2cbccecd87779351ff1785d34a796060139518c4d - Sigstore transparency entry: 1250034894
- Sigstore integration time:
-
Permalink:
AlexanderCollins/TurboDRF@7964c6ecb5b42ec2e80d21cf434de17f24f5e18a -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/AlexanderCollins
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7964c6ecb5b42ec2e80d21cf434de17f24f5e18a -
Trigger Event:
release
-
Statement type:
File details
Details for the file turbodrf-0.3.0-py3-none-any.whl.
File metadata
- Download URL: turbodrf-0.3.0-py3-none-any.whl
- Upload date:
- Size: 69.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8000bdbd0fe8a45da070d5106863175c3106ccb7953ac64c235249bc979972c7
|
|
| MD5 |
a80dd806a43b22a9206a4ef8717812a4
|
|
| BLAKE2b-256 |
ee1c7420d0c6733f6dd90c7b3f65b2c546b5cb1a33ceb36c796dc4f707c94af1
|
Provenance
The following attestation bundles were made for turbodrf-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on AlexanderCollins/TurboDRF
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turbodrf-0.3.0-py3-none-any.whl -
Subject digest:
8000bdbd0fe8a45da070d5106863175c3106ccb7953ac64c235249bc979972c7 - Sigstore transparency entry: 1250034931
- Sigstore integration time:
-
Permalink:
AlexanderCollins/TurboDRF@7964c6ecb5b42ec2e80d21cf434de17f24f5e18a -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/AlexanderCollins
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7964c6ecb5b42ec2e80d21cf434de17f24f5e18a -
Trigger Event:
release
-
Statement type: