Skip to content

Releases: hbakri/django-ninja-crud

v0.6.2

22 Sep 10:42
cde7e2d
Compare
Choose a tag to compare

What's Changed in v0.6.2

🐝 Bug Fixes

  • fix: 🐝 path parameters incorrectly marked as optional sometimes by @hbakri in #475

📚 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

🔖 Release

  • release: 🔖 bump version to 0.6.2 by @hbakri in #479

Full Changelog: v0.6.1...v0.6.2

v0.6.1

04 Aug 22:24
ec96280
Compare
Choose a tag to compare

🔥 Unlocking ASYNC Support in Django Ninja CRUD!

9rmYyx

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 in APIView by @hbakri in #449
  • docs: 📚 update README and documentation guides 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

28 Jul 16:21
383afe6
Compare
Choose a tag to compare

🌞 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:

  1. 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.

  2. Bug Squashing and Code Slimming: I've hunted down every reported bug and trimmed the codebase for better performance and easier maintenance.

  3. 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 to methods 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 in pyproject.toml by @hbakri in #429
  • refactor: ⚒️ move PathParametersTypeResolver logic in APIView 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

20 May 00:02
0ddde8c
Compare
Choose a tag to compare

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 in ListModelView by @hbakri in #358
  • fix: 🐝 preserve declaration order of views in OpenAPI docs by @hbakri in #359
  • fix: 🐝 remove filters in OpenAPI docs when filter_schema is not defined by @hbakri in #361
  • feat!: ✨ remove path inference from the model when detail=True by @hbakri in #363
  • refactor!: ⚒️ remove detail flag in favour of path-based view definition by @hbakri in #366
  • refactor: ⚒️ standardise schemas attributes in AbstractModelView for RESTful consistency by @hbakri in #368
  • refactor!: ⚒️ rename output_schema to response_schema by @hbakri in #369
  • fix: 🐝 remove default_response_schema in README.md until the v0.5.0 update by @hbakri in #371
  • refactor!: ⚒️ rename input_schema to payload_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 as pre-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 to ReadModelView by @hbakri in #401
  • refactor!: ⚒️ Comprehensive refactor of the core's architecture by @hbakri in #407
  • docs: 📚 update README.md for v0.5 by @hbakri in #410

New Contributors

Full Changelog: v0.4.1...v0.5.0

v0.4.1

29 Nov 17:39
e071351
Compare
Choose a tag to compare

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 Django 5.0b1 and Python 3.12, staying ahead with the latest tech stack (#293, #297).

  • Workflow Enhancements:
    Improved CI workflows for tests, coverage reporting, and harmonization with Python 3.12 (#298, #300).

🔧 Chores and Refinements

  • Configuration Adjustments:
    Streamlined pre-commit settings and updated requirements in our README and guides for a smoother setup experience (#295, #302).

⚒️ Refactoring

  • Consolidated Request Handling:
    Refactored perform_request logic into AbstractModelViewTest for enhanced clarity and maintainability (#328).

  • Streamlined Testing Framework:
    Removed TestAssertionHelper class to consolidate our testing approach, making it more intuitive and straightforward (#330).

  • Refined ModelView Configuration:
    Moved configure_route to AbstractModelView for better encapsulation and easier route customization (#324).

Full Changelog: View the complete list of changes

v0.4.0

04 Nov 23:36
22fb72f
Compare
Choose a tag to compare

Release Notes: v0.4.0 💃

Date: November 5, 2023

🎉 New Features

  • Default Schema Definitions for ModelViewSet:
    Introduced default_input_schema and default_output_schema at ModelViewSet level to simplify schema management across CRUD operations (#261).

  • New BaseModelViewSet Class:
    A new BaseModelViewSet 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 Ninja v1.0 beta 2, integrating the latest features and improvements (#277).

💥 Breaking Changes & Migration Guides

  • Refactoring of Testing Module:
    The testing 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 and viewsets modules have been restructured for improved clarity. Update your imports following the instructions provided below (#274).

  • Class Attribute Renaming:
    model_class has been renamed to model, and model_view_set_class to model_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:
    Integrated ruff into the pre-commit configuration for improved linting processes (#275).

⚒️ Refactoring

  • Validation in ModelViewSet Initialization:
    Validation logic in ModelViewSet 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 from ninja_crud.views to ninja_crud.viewsets as outlined in the provided migration steps (#274).

For Class Attribute Renaming:

  • In all subclass definitions of ModelViewSet and ModelViewSetTestCase, replace model_class with model and model_view_set_class with model_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

13 Oct 14:29
86a8151
Compare
Choose a tag to compare

Release Notes: v0.3.3 ✨

Date: October 13, 2023

✨ New Features

  • Pagination Control: Added option to disable or override the default LimitOffsetPagination class (#254).

📚 Documentation

  • Type Hint Corrections: Corrected Optional type hints in docstrings for accuracy and clarity (#256).

v0.3.2

08 Oct 20:49
5b013cb
Compare
Choose a tag to compare

Release Notes: v0.3.2 ✨

Date: October 8, 2023

✨ New Features

  • Router Parameters Override: added support for overriding summary, operation_id and most importantly path (#236, #241).

🛠 Refactoring

  • Test Framework: moved HTTPStatus checks into RequestComposer class and renamed RequestComposer to TestComposer (#232, #234).
  • Abstract Model View: generalized method, path and detail attributes to AbstractModelView (#241, #247).

🏄‍♂️ Code Quality

  • PEP 484: made Optional type hints explicit according to PEP 484 (#243).

v0.3.1

05 Sep 21:23
1414d2a
Compare
Choose a tag to compare

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 from TestCase (#228).

📚 Documentation

  • Contribution Guidelines: Updated CONTRIBUTION.md to provide better clarity for potential contributors (#217).
  • README and Examples: Updated README.md and 04-Examples.md for the v0.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

24 Aug 18:00
b800197
Compare
Choose a tag to compare

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.