Releases: hbakri/django-ninja-crud
v0.6.2
What's Changed in v0.6.2
🐝 Bug Fixes
📚 Documentation
- docs: 📚 refactor international documentation section by @hbakri in #459
- docs(readme): 📚 update banner with new design and rewrite introduction by @hbakri in #472
- docs(readme): 📚 add code preview image to readme for visual demonstration by @hbakri in #474
- docs: 📚 sync documentation guides with readme by @hbakri in #478
👷 CI Improvements
- ci(pre-commit): 👷 auto update by @pre-commit-ci in (#456, #457, #463, #464, #465, #469)
- ci(tests): 👷♂️ add Django 5.1 by @hbakri in #461
- ci(tests): 👷♂️ add Django Ninja 1.3 by @hbakri in #467
🔖 Release
Full Changelog: v0.6.1...v0.6.2
v0.6.1
🔥 Unlocking ASYNC Support in Django Ninja CRUD!
This update significantly expands Django Ninja CRUD's capabilities, allowing developers to leverage asynchronous programming in their custom API views. By releasing async APIView
support early in v0.6.1
, developers can start experimenting and implementing async views immediately. Full async support for built-in CRUD operations is planned for v0.7.0
! 🌞
How to define an async reusable view?
Define async reusable views the same way as synchronous ones, using async/await
notations for the handler
method:
# examples/reusable_views.py
from typing import Optional, Type
from uuid import UUID
import pydantic
from django.db import models
from django.http import HttpRequest
from ninja_crud.views import APIView
class ReusableSyncReadView(APIView):
def __init__(
self,
name: Optional[str] = None,
model: Optional[Type[models.Model]] = None,
response_body: Optional[Type[pydantic.BaseModel]] = None,
) -> None:
super().__init__(
name=name,
methods=["GET"],
path="/{id}",
response_status=200,
response_body=response_body,
model=model,
)
def handler(self, request: HttpRequest, id: UUID) -> models.Model:
return self.model.objects.get(id=id)
class ReusableAsyncReadView(APIView):
def __init__(
self,
name: Optional[str] = None,
model: Optional[Type[models.Model]] = None,
response_body: Optional[Type[pydantic.BaseModel]] = None,
) -> None:
super().__init__(
name=name,
methods=["GET"],
path="/{id}",
response_status=200,
response_body=response_body,
model=model,
)
async def handler(self, request: HttpRequest, id: UUID) -> models.Model:
return await self.model.objects.aget(id=id)
What's Changed
- feat: 🌞 add
async
handler support inAPIView
by @hbakri in #449 - docs: 📚 update
README
and documentationguides
by @hbakri in #451 - fix: 🐝 expose
viewsets
module in root__init__.py
by @hbakri in #454
Full Changelog: v0.6.0...v0.6.1
v0.6.0
🌞 Hey there, Django Ninja CRUD community!
First off, I owe you all an apology for the delay in fixing the OpenAPI bug (#415) that many of you reported. Thanks for your patience while I took some time off and regrouped.
The silver lining? This break gave me a chance to step back and rethink some core aspects of the package. As a result, v0.6.0 isn't just about bug fixes – it's packed with improvements and new features:
-
Unrestricted Handler Signatures: Django Ninja CRUD now supports ANY handler signature, not just Path, Query, and Body. You can make pretty much any synchronous view reusable with this package now.
-
Bug Squashing and Code Slimming: I've hunted down every reported bug and trimmed the codebase for better performance and easier maintenance.
-
Gearing Up for Async: This release sets the stage for v0.7.0, where we'll be introducing ASYNC REUSABLE VIEWS 🔥
Your feedback and support keep this project moving forward. Thanks for sticking with Django Ninja CRUD!
What's Changed
- refactor: ⚒️
PathParametersTypeResolver
by @hbakri in #420 - refactor!: 🛠️ subclass-specific request components by @hbakri in #424
- refactor!: ⚒️ change
method
tomethods
for more flexibility by @hbakri in #425 - ci: 👷 add Django Ninja 1.2 to test matrix and removed Django 3.2 and 4.1 by @hbakri in #427
- chore: ⚙️ update
ruff
configuration inpyproject.toml
by @hbakri in #429 - refactor: ⚒️ move
PathParametersTypeResolver
logic inAPIView
by @hbakri in #433 - refactor!: ⚒️ remove
django-rest-testing
integration by @hbakri in #437 - docs: 📚 revamp
README.md
and documentation by @hbakri in #439 - docs: 📚 add link to Chinese documentation by @hbakri in #440
- refactor: ⚒️ update Pydantic
.dict()
calls to.model_dump()
by @hbakri in #444
Full Changelog: v0.5.0...v0.6.0
v0.5.0
Release Notes: v0.5.0 🔥
Date: May 20, 2024
Important
With this release of version 0.5
, Django Ninja CRUD introduces significant
and breaking changes. Users are strongly advised to pin their requirements to the
appropriate version to ensure compatibility with their projects.
What's Changed
- docs: 📚 fix
ModelViewSetTestCase
examples by @hbakri in #340 - docs: 📚 remove
super().setUpTestData()
calls in examples by @hbakri in #341 - feat: ✨ add support for Django Ninja
v1.1
by @hbakri in #345 - feat: ✨ add support for Django
v5.0
by @hbakri in #346 - docs: 📚 update
README.md
by @hbakri in #349 - chore: 👷♂️ update
ruff
version by @hbakri in #351 - feat!: ✨ remove
BaseModelViewSet
to emphasise explicit declarations by @hbakri in #357 - refactor!: ⚒️ streamline
order_by
filtering logic inListModelView
by @hbakri in #358 - fix: 🐝 preserve declaration order of
views
inOpenAPI
docs by @hbakri in #359 - fix: 🐝 remove
filters
inOpenAPI
docs whenfilter_schema
is not defined by @hbakri in #361 - feat!: ✨ remove
path
inference from themodel
whendetail=True
by @hbakri in #363 - refactor!: ⚒️ remove
detail
flag in favour ofpath
-based view definition by @hbakri in #366 - refactor: ⚒️ standardise
schemas
attributes inAbstractModelView
for RESTful consistency by @hbakri in #368 - refactor!: ⚒️ rename
output_schema
toresponse_schema
by @hbakri in #369 - fix: 🐝 remove
default_response_schema
inREADME.md
until thev0.5.0
update by @hbakri in #371 - refactor!: ⚒️ rename
input_schema
topayload_schema
by @hbakri in #373 - refactor(views)!: ⚒️ introduce
AbstractView
and standardise request components by @hbakri in #381 - chore: 👷 update
ruff
version by @hbakri in #387 - chore: 👷 add
MyPy
aspre-commit
hook by @hbakri in #389 - chore: 👷 create
dependabot.yml
by @hbakri in #390 - chore(deps): bump actions/setup-python from 4 to 5 by @dependabot in #391
- chore(deps): bump codecov/codecov-action from 3 to 4 by @dependabot in #392
- chore(deps): bump actions/checkout from 3 to 4 by @dependabot in #393
- fix: Add support for
ManyToManyField
with create/update views by @cyberbuff in #394 - refactor(views)!: 🛠️ enhanced model view interfaces enabling
service
architecture support by @hbakri in #398 - refactor!: 🛠️ rename
RetrieveModelView
toReadModelView
by @hbakri in #401 - refactor!: ⚒️ Comprehensive refactor of the core's architecture by @hbakri in #407
- docs: 📚 update
README.md
forv0.5
by @hbakri in #410
New Contributors
- @dependabot made their first contribution in #391
- @cyberbuff made their first contribution in #394
- @pre-commit-ci made their first contribution in #397
Full Changelog: v0.4.1...v0.5.0
v0.4.1
Release Notes: v0.4.1 🌟
Date: November 29, 2023
In this release, we focus on enriching the developer experience with comprehensive documentation for every class and a major shift in how you access and interact with our guides. Version v0.4.1
may not be feature-heavy, but it marks a pivotal point in our project's maturity – establishing itself as a reference version with detailed docstrings across the board. We're also thrilled to announce our migration from GitHub Wiki to readme.io for our documentation hosting. This move unlocks versioned documentation, a sleek interface, and forthcoming advanced guides and recipes that leverage the full potential of readme.io's features.
📚 Documentation and Guides
-
Complete Class Documentation:
Every class, from views to testing components, is now meticulously documented, providing clarity and a solid foundation for best practices (#309, #311, #332). -
Migration to readme.io:
Transitioned from GitHub Wiki to readme.io for documentation hosting, introducing versioning and improved aesthetics for our documentation (#315, #321).
✨ New Features
-
Support for Django Ninja
v1.0
:
We've added support for the latest version of Django Ninja, ensuring compatibility and cutting-edge functionality (#291). -
Enhanced Property Support:
New property support and type checks have been introduced for testing components, expanding our framework's versatility (#307). -
Flexible Base Path Configuration:
base_path
now gracefully handles leading or trailing slashes, simplifying endpoint definition (#327).
⚙️ Continuous Integration & Workflows
-
Testing Across Versions:
Extended our test suite to include Django5.0b1
and Python3.12
, staying ahead with the latest tech stack (#293, #297). -
Workflow Enhancements:
Improved CI workflows for tests, coverage reporting, and harmonization with Python3.12
(#298, #300).
🔧 Chores and Refinements
- Configuration Adjustments:
Streamlined pre-commit settings and updatedrequirements
in our README and guides for a smoother setup experience (#295, #302).
⚒️ Refactoring
-
Consolidated Request Handling:
Refactoredperform_request
logic intoAbstractModelViewTest
for enhanced clarity and maintainability (#328). -
Streamlined Testing Framework:
RemovedTestAssertionHelper
class to consolidate our testing approach, making it more intuitive and straightforward (#330). -
Refined ModelView Configuration:
Movedconfigure_route
toAbstractModelView
for better encapsulation and easier route customization (#324).
Full Changelog: View the complete list of changes
v0.4.0
Release Notes: v0.4.0 💃
Date: November 5, 2023
🎉 New Features
-
Default Schema Definitions for ModelViewSet:
Introduceddefault_input_schema
anddefault_output_schema
atModelViewSet
level to simplify schema management across CRUD operations (#261). -
New BaseModelViewSet Class:
A newBaseModelViewSet
class has been added to reduce redundancy and promote consistency in CRUD operations (#263). -
Support for Django Ninja v1.0b2:
Ensured full support for Django Ninjav1.0 beta 2
, integrating the latest features and improvements (#277).
💥 Breaking Changes & Migration Guides
-
Refactoring of Testing Module:
Thetesting
module has undergone significant refactoring. Please follow the detailed migration guide to adapt your code to these changes (#272). -
Reorganization of ViewSets and Views:
views
andviewsets
modules have been restructured for improved clarity. Update your imports following the instructions provided below (#274). -
Class Attribute Renaming:
model_class
has been renamed tomodel
, andmodel_view_set_class
tomodel_viewset_class
. Please see the migration guide for the necessary changes (#284, #279). -
Deprecation of Python 3.7 Support:
Python 3.7 support has been deprecated as part of our ongoing commitment to maintain the package up-to-date with current best practices (#275).
🔧 Chores
- Pre-commit Linting with Ruff:
Integratedruff
into the pre-commit configuration for improved linting processes (#275).
⚒️ Refactoring
-
Validation in ModelViewSet Initialization:
Validation logic inModelViewSet
has been moved into the__init_subclass__
method to enhance subclassing mechanics (#264). -
Removal of PartialUpdateModelView:
PartialUpdateModelView
has been removed to advocate for explicit view configurations, aligning with explicitness over implicitness principles (#270).
👨🎨 Migration Guides
For the Testing Module Refactor:
- Adjust your imports according to the new module structure and naming conventions detailed in the summary of changes above (#272).
For Views and ViewSets Module Reorganization:
- Update your
ModelViewSet
imports fromninja_crud.views
toninja_crud.viewsets
as outlined in the provided migration steps (#274).
For Class Attribute Renaming:
- In all subclass definitions of
ModelViewSet
andModelViewSetTestCase
, replacemodel_class
withmodel
andmodel_view_set_class
withmodel_viewset_class
, respectively, as directed in the migration guide.
We understand these updates may require you to make changes to your codebase. We're here to help guide you through this transition, so please reach out if you need further assistance or clarification.
v0.3.3
v0.3.2
Release Notes: v0.3.2 ✨
Date: October 8, 2023
✨ New Features
- Router Parameters Override: added support for overriding
summary
,operation_id
and most importantlypath
(#236, #241).
🛠 Refactoring
- Test Framework: moved
HTTPStatus
checks intoRequestComposer
class and renamedRequestComposer
toTestComposer
(#232, #234). - Abstract Model View: generalized
method
,path
anddetail
attributes toAbstractModelView
(#241, #247).
🏄♂️ Code Quality
- PEP 484: made
Optional
type hintsexplicit
according to PEP 484 (#243).
v0.3.1
Release Notes: v0.3.1 ✨
Date: September 5, 2023
🛠 Refactoring
- Rename Test Classes: All test classes have been renamed to follow Python unittest conventions by having "Test" as a prefix. This change comes with deprecation warnings for the old class names (#222).
🐛 Bug Fixes
- TestModelViewSetMeta Error Message: Improved the error message in
TestModelViewSetMeta
to be more informative when the class is not subclassed fromTestCase
(#228).
📚 Documentation
- Contribution Guidelines: Updated
CONTRIBUTION.md
to provide better clarity for potential contributors (#217). - README and Examples: Updated
README.md
and04-Examples.md
for thev0.3.1
release, including new changes (#226).
📣 Note
This is a minor release that includes important refactoring. Existing users are encouraged to update to this version for a smoother development experience. Note that the test class renaming includes deprecation warnings for the old class names, so it's important to transition to the new naming convention.
v0.3.0.post1
Release Notes: v0.3.0.post1 🛠️
Date: August 24, 2023
📚 Documentation
- README Logo on PyPI: Fixed the relative path to the project logo in the README to ensure it displays correctly on PyPI (#196).
📣 Note
This is a non-functional change and does not affect the library's behavior or performance. Existing users do not need to update unless they specifically wish to see the corrected documentation on PyPI.