Changelog¶
All notable changes to drf-restflow will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[1.1.0] - 2026-05-26¶
Added¶
Caching¶
@cache_responsedecorator for whole-view and@api_viewHTTP caching. Stores the rendered response triple (content, status code, headers) and rebuilds a plainHttpResponseon a hit.set_cache_headers=Falseflag on@cache_response. When set toTrue, the wrapper attaches theX-Cached-at,X-Cache-reset-at, andX-Cache-statusheaders to every returned response so clients and monitoring can tell hits from misses without a separate metadata lookup.ResponseCacheKeyConstructordefault key constructor for@cache_response. Hashes the full query string and captures the view method's URL kwargs as the partition.ViewKwargsKeyFieldcache-key field that captures a view method's URL kwargs while skippingself,cls, andrequest.
Responses¶
restflow.responses.Responsewith anarender()method. Renders content and awaits any coroutine-function post-render callbacks on the live event loop. Async views and@cache_responseon async methods use this path to keep rendering on the loop instead of bouncing throughasync_to_sync.
Fixes¶
set_response_cache_headeremitted theX-Cache-statusheader as"CacheStatus.MISS"instead of"MISS"on Python 3.11+ becausestr(enum)now includes the class name. The helper now writes the enum'svalueso the header matches the documented vocabulary (HIT,MISS,STALE,BYPASS,REFRESH).ArgsKeyField.get_key_payloadnow usesinspect.Signature.bind_partialinstead ofbind, so invalidation handlers that supply only the fields named infield_mapping(for example, a view method whose signature includesselfandrequest) no longer raiseTypeError: missing a required argumentand abort the rule.
[1.0.2] - 2026-05-26¶
Fixes¶
- Fix circular import on Django startup when
restflow.authentication.JWTAuthenticationis listed inREST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"]. The package no longer re-exports view classes at import time, breaking the cycle betweenrestflow.authentication,restflow.views, andrest_framework.viewsduring DRF settings resolution.
Breaking¶
TokenObtainView,TokenRefreshView, andTokenBlacklistVieware no longer re-exported fromrestflow.authentication. Import them fromrestflow.authentication.viewsinstead.
# Before
from restflow.authentication import TokenObtainView, TokenRefreshView, TokenBlacklistView
# After
from restflow.authentication.views import TokenObtainView, TokenRefreshView, TokenBlacklistView
[1.0.1] - 2026-05-25¶
Fixes¶
- Fix Response caching bug
[1.0.0] - 2026-05-19¶
Added¶
Serializers¶
Serializer,ModelSerializer, andHyperlinkedModelSerializerwith annotation-driven field declaration using Python type hintsFieldsentinel for layering DRF kwargs on top of annotated fields- Full async surface:
ais_valid,arun_validation,ato_internal_value,asave,acreate,aupdate,ato_representation ModelSerializerships default asyncacreateandaupdatethat mirror DRF's sync logic using the async ORMInlineSerializerfactory for building serializer classes at runtime without a dedicated class definitionValidatedDatadict subclass with attribute access andto_json()helperEmail,IPAddress, andBlankableStringtype aliases;SerializerFieldMapfor custom type-to-field mappingsDecimalFieldsubclass with sensible default precision (max_digits=20,decimal_places=6)
Views¶
APIViewwith the helper surface (get_serializer,validated_serializer,serialized_response,paginated_response) on top of DRF's sync viewAsyncAPIViewwith a fully async dispatch loop and async twins for every helper- Async generic views:
AsyncListAPIView,AsyncCreateAPIView,AsyncRetrieveAPIView,AsyncUpdateAPIView,AsyncDestroyAPIView, and all composite combinations - Async model mixins:
AsyncCreateModelMixin,AsyncListModelMixin,AsyncRetrieveModelMixin,AsyncUpdateModelMixin,AsyncDestroyModelMixin AsyncViewSet,AsyncGenericViewSet,AsyncReadOnlyModelViewSet,AsyncModelViewSetActionConfigdataclass for per-action serializer, permission, throttle, parser, renderer, pagination, and queryset overridesrequest_serializer_class/response_serializer_classsplit on viewsets andAPIViewPostFetchhelper for attaching related rows to paginated lists outside ofprefetch_related
Authentication¶
- Async-aware
BaseAuthenticationwithaauthenticateon every built-in DRF class:BasicAuthentication,SessionAuthentication,TokenAuthentication,RemoteUserAuthentication - Built-in JWT authentication (
JWTAuthentication) with access and refresh tokens, blacklist support via pluggable backends, refresh token rotation, and configurable claims - Pre-built JWT views:
ObtainTokenView,RefreshTokenView,VerifyTokenView SimpleJWTAdapterfor projects already usingdjangorestframework-simplejwt
Permissions¶
- Async-aware variants of all standard DRF permission classes with
ahas_permissionandahas_object_permission - Boolean combinators:
AND,OR,NOTfor composing permission rules without subclassing
Throttling¶
- Async-aware
SimpleRateThrottle,AnonRateThrottle,UserRateThrottle,ScopedRateThrottlewithaallow_requestandawait_
Pagination¶
AsyncPageNumberPagination,AsyncLimitOffsetPagination,AsyncCursorPaginationFastPageNumberPagination(omitscountfor performance)
Responses¶
NDJSONResponsefor newline-delimited JSON streamingStreamingJSONListResponsefor streaming a JSON arraySSEResponsefor Server-Sent Events with automaticX-Accel-Buffering: no
Exception handler¶
restflow_exception_handlerwith structured error codes alongside DRF's standard detail/code shape
Caching¶
- Async-aware cache key constructors
Spectacular (drf-spectacular integration)¶
RestflowAutoSchemaresolvingaction_configs,request_serializer_class/response_serializer_class, and per-action paginationadd_filterset_parameterspostprocessing hook that injects filter query parameters for any view declaringfilterset_class, including plainAPIView
Testing¶
AsyncAPIClientandAsyncRequestFactoryfor testing async views withoutsync_to_asyncwrappersAsyncAPITestCasebase class
[1.0.0a2] - 2025-12-03¶
Breaking Changes¶
- Renamed
lookup_exprtofilter_by: - All Field classes now use
filter_byparameter instead oflookup_exprfor defining filter behavior. Update all field definitions:lookup_expr="name__icontains"becomesfilter_by="name__icontains" -
Internal method
ensure_lookup_expr()renamed toensure_db_field() -
Removed
descriptionparameter: Field'sdescriptionparameter has been removed - Use Django REST Framework's
help_textparameter instead for field documentation
Added¶
- db_field parameter: New parameter for dynamic lookup field generation
- Allows creating filter fields with different names that map to the same database field
- Example:
product_price = IntegerField(db_field="price", lookups=["comparison"])creates multiple filters (product_price, product_price__gt, etc.) that all filter against the "price" database field -
Enables lookup generation when using
methodor customfilter_byfunctions -
Enhanced validation: Added validation to ensure
db_fieldis set when usinglookupswith custommethodorfilter_byparameters - Provides clear error messages with examples when validation fails
Changed¶
- Improved filter field handling with better separation between field name (API) and database field name (ORM queries)
- Enhanced error messages with more descriptive and actionable text
- Model-based field generation now automatically sets both
filter_byanddb_fieldparameters - Related field filtering (ForeignKey, OneToOneField) correctly sets both parameters
Documentation¶
- Updated all references from
lookup_exprtofilter_byacross documentation - Added comprehensive examples for
db_fieldparameter usage - Expanded FilterSet and Field guides with new parameter explanations
- Updated tutorial and quick start guides with new syntax
Migration from 1.0.0a1¶
- Replace
lookup_exprwithfilter_byin all FilterSet field definitions - Replace
descriptionparameter withhelp_textif used - Custom filter method signatures remain unchanged and compatible
[1.0.0a1] - 2025-11-25¶
Added¶
Core Features¶
- FilterSet: Declarative filtering system for Django REST Framework
- Field Types: Comprehensive set of filter fields
- StringField, IntegerField, FloatField, DecimalField
- BooleanField, DateField, DateTimeField, TimeField, DurationField
- ChoiceField, MultipleChoiceField
- EmailField, IPAddressField
- ListField for array filtering
- OrderField for result ordering
- RelatedField for related fields in models
- Field base class for custom filters
Declaration Styles¶
- Type annotation support (
name: str,price: int) - Explicit field declarations
- Model-based automatic field generation
- Mixed declaration styles
Lookup System¶
- Automatic lookup generation from field definitions
- Lookup categories (basic, text, comparison, date, time, postgres, pg_array)
- Custom lookup expressions via strings or callables
- Field variants (base field + lookups + negations)
Filtering Features¶
- Negation support via
!suffix - Multiple filter operators (AND, OR, XOR)
- Custom filter methods
- Preprocessors and postprocessors
- Related field filtering
Ordering¶
- OrderField for flexible result ordering
- Ascending/descending support
- Multiple field ordering
- Configurable ordering direction
PostgreSQL Support¶
- PostgreSQL array field filtering
- Array lookups (contains, overlaps, contained_by)
- Full-text search support
- Trigram similarity
Model Integration¶
- Automatic field generation from Django models
- Support for model field types
- ForeignKey and OneToOneField filtering
- Model choice field detection
Validation¶
- Built on DRF's validation system
- Automatic type conversion
- Field-level and custom validators
- Detailed error messages
Type Safety¶
- Python type hint support
- Automatic field type inference
- Type mapping for common Python types
- Literal type for choices
Documentation¶
- Comprehensive user guide
- API reference
- Quick start tutorial
- PostgreSQL guide
- Migration guide from django-filter
Testing¶
- Test suite with 95%+ coverage
- PostgreSQL-specific tests
- Multiple Python version support (3.10-3.14)
- Multiple Django version support (3.2-5.2)
- CI/CD with GitHub Actions
Developer Experience¶
- Modern Python features (type hints, dataclasses)
- Clear error messages
- Extensive docstrings
- IDE-friendly API
Version Support¶
| Version | Python | Django | DRF | Status |
|---|---|---|---|---|
| 1.0.0a1 | 3.10-3.14 | 3.2-5.2 | 3.14+ | Alpha |
Migration from django-filter¶
drf-restflow offers similar functionality to django-filter with a more modern, declarative API. Key differences:
- Type annotations: Use Python type hints instead of explicit field declarations
- Automatic negation: Built-in
!suffix support for all filters - Lookup categories: Group related lookups (e.g., "comparison" for gt/gte/lt/lte)
- Better validation: Integrated with DRF's validation system
For migration assistance, refer to the FilterSet Guide and Fields Guide for comprehensive documentation.
Deprecation Policy¶
Following semantic versioning:
- Major versions (x.0.0): May include breaking changes
- Minor versions (0.x.0): New features, backward compatible
- Patch versions (0.0.x): Bug fixes, backward compatible
Deprecation warnings will be issued for at least one minor version before removal.
Reporting Issues¶
Found a bug or have a feature request? Please open an issue on GitHub.
Contributing¶
See Contributing Guide for information on how to contribute to this changelog and the project.