REST API Layer
bloom_rest delivers a Django REST Framework (DRF) style API architecture on top of BloomApiRouter and bloom_db.
BloomViewSet & Mounting
mountViewSet<T> binds a full suite of CRUD endpoints (list, retrieve, create, update, destroy) onto BloomApiRouter with pagination, permissions, throttling, and filtering in a single declaration:
Serializers & FieldSets
BloomModelSerializer inspects ModelMeta to serialize and deserialize model instances. BloomFieldSet provides granular control over field exposure:
BloomFieldSet.all().withReadOnly(['id', 'createdAt'])— Exposes all fields, preventing clients from mutating identifier or timestamp columns.BloomFieldSet.only(['id', 'title', 'content'])— Whitelists specific fields for serialization.BloomFieldSet.exclude(['passwordHash'])— Strips sensitive fields from serialized responses.
Pluggable Pagination
PageNumberPagination
?page=1&page_size=20
Returns count, total_pages, page, and results.
LimitOffsetPagination
?limit=20&offset=40
Returns count, limit, offset, and results.
CursorPagination
?cursor=eyJpZ...
Keyset pagination with opaque base64 cursors, immune to pagination drift.
Composable Permissions
Permission classes can be composed with boolean logic (.and(), .or(), .negate()):
IsAuthenticated()— Requires an authenticated session token.IsStaff()/IsSuperuser()— Requires administrative role claims.AllowAny()— Public access without restriction.IsReadOnly()— Permits safe methods (GET,HEAD,OPTIONS).
Throttling & Filter Backends
BloomThrottle.fromRate() enforces DRF rate strings like "100/hour" or "10/minute" backed by BloomCache. Filter backends provide out-of-the-box support for query string parameters:
BloomSearchFilter— Multi-field search (?search=term).BloomOrderingFilter— Dynamic sort ordering (?ordering=-createdAt,title).BloomFieldFilter— Exact and lookup filtering (?status=published&view_count__gte=10).