Django-ninja-crud

Latest version: v0.6.2

Safety actively analyzes 681866 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

0.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
* 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
* release: 🔖 bump version to `0.6.2` by hbakri in 479


**Full Changelog**: https://github.com/hbakri/django-ninja-crud/compare/v0.6.1...v0.6.2

0.6.1

🔥 Unlocking ASYNC Support in Django Ninja CRUD!

![9rmYyx](https://github.com/user-attachments/assets/23ed3003-cedb-4910-9b2e-e43f7e2be00f)

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:

python
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 https://github.com/hbakri/django-ninja-crud/pull/449
* docs: 📚 update `README` and documentation `guides` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/451
* fix: 🐝 expose `viewsets` module in root `__init__.py` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/454


**Full Changelog**: https://github.com/hbakri/django-ninja-crud/compare/v0.6.0...v0.6.1

0.6.0

🌞 Hey there, Django Ninja CRUD community!

First off, I owe you all an apology for the delay in fixing the OpenAPI bug (https://github.com/hbakri/django-ninja-crud/pull/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 https://github.com/hbakri/django-ninja-crud/pull/420
* refactor!: 🛠️ subclass-specific request components by hbakri in https://github.com/hbakri/django-ninja-crud/pull/424
* refactor!: ⚒️ change `method` to `methods` for more flexibility by hbakri in https://github.com/hbakri/django-ninja-crud/pull/425
* ci: 👷 add Django Ninja 1.2 to test matrix and removed Django 3.2 and 4.1 by hbakri in https://github.com/hbakri/django-ninja-crud/pull/427
* chore: ⚙️ update `ruff` configuration in `pyproject.toml` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/429
* refactor: ⚒️ move `PathParametersTypeResolver` logic in `APIView` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/433
* refactor!: ⚒️ remove `django-rest-testing` integration by hbakri in https://github.com/hbakri/django-ninja-crud/pull/437
* docs: 📚 revamp `README.md` and documentation by hbakri in https://github.com/hbakri/django-ninja-crud/pull/439
* docs: 📚 add link to Chinese documentation by hbakri in https://github.com/hbakri/django-ninja-crud/pull/440
* refactor: ⚒️ update Pydantic `.dict()` calls to `.model_dump()` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/444


**Full Changelog**: https://github.com/hbakri/django-ninja-crud/compare/v0.5.0...v0.6.0

0.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 https://github.com/hbakri/django-ninja-crud/pull/340
* docs: 📚 remove `super().setUpTestData()` calls in examples by hbakri in https://github.com/hbakri/django-ninja-crud/pull/341
* feat: ✨ add support for Django Ninja `v1.1` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/345
* feat: ✨ add support for Django `v5.0` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/346
* docs: 📚 update `README.md` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/349
* chore: 👷‍♂️ update `ruff` version by hbakri in https://github.com/hbakri/django-ninja-crud/pull/351
* feat!: ✨ remove `BaseModelViewSet` to emphasise explicit declarations by hbakri in https://github.com/hbakri/django-ninja-crud/pull/357
* refactor!: ⚒️ streamline `order_by` filtering logic in `ListModelView` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/358
* fix: 🐝 preserve declaration order of `views` in `OpenAPI` docs by hbakri in https://github.com/hbakri/django-ninja-crud/pull/359
* fix: 🐝 remove `filters` in `OpenAPI` docs when `filter_schema` is not defined by hbakri in https://github.com/hbakri/django-ninja-crud/pull/361
* feat!: ✨ remove `path` inference from the `model` when `detail=True` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/363
* refactor!: ⚒️ remove `detail` flag in favour of `path`-based view definition by hbakri in https://github.com/hbakri/django-ninja-crud/pull/366
* refactor: ⚒️ standardise `schemas` attributes in `AbstractModelView` for RESTful consistency by hbakri in https://github.com/hbakri/django-ninja-crud/pull/368
* refactor!: ⚒️ rename `output_schema` to `response_schema` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/369
* fix: 🐝 remove `default_response_schema` in `README.md` until the `v0.5.0` update by hbakri in https://github.com/hbakri/django-ninja-crud/pull/371
* refactor!: ⚒️ rename `input_schema` to `payload_schema` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/373
* refactor(views)!: ⚒️ introduce `AbstractView` and standardise request components by hbakri in https://github.com/hbakri/django-ninja-crud/pull/381
* chore: 👷 update `ruff` version by hbakri in https://github.com/hbakri/django-ninja-crud/pull/387
* chore: 👷 add `MyPy` as `pre-commit` hook by hbakri in https://github.com/hbakri/django-ninja-crud/pull/389
* chore: 👷 create `dependabot.yml` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/390
* chore(deps): bump actions/setup-python from 4 to 5 by dependabot in https://github.com/hbakri/django-ninja-crud/pull/391
* chore(deps): bump codecov/codecov-action from 3 to 4 by dependabot in https://github.com/hbakri/django-ninja-crud/pull/392
* chore(deps): bump actions/checkout from 3 to 4 by dependabot in https://github.com/hbakri/django-ninja-crud/pull/393
* fix: Add support for `ManyToManyField` with create/update views by cyberbuff in https://github.com/hbakri/django-ninja-crud/pull/394
* refactor(views)!: 🛠️ enhanced model view interfaces enabling `service` architecture support by hbakri in https://github.com/hbakri/django-ninja-crud/pull/398
* refactor!: 🛠️ rename `RetrieveModelView` to `ReadModelView` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/401
* refactor!: ⚒️ Comprehensive refactor of the core's architecture by hbakri in https://github.com/hbakri/django-ninja-crud/pull/407
* docs: 📚 update `README.md` for `v0.5` by hbakri in https://github.com/hbakri/django-ninja-crud/pull/410

New Contributors
* dependabot made their first contribution in https://github.com/hbakri/django-ninja-crud/pull/391
* cyberbuff made their first contribution in https://github.com/hbakri/django-ninja-crud/pull/394
* pre-commit-ci made their first contribution in https://github.com/hbakri/django-ninja-crud/pull/397

**Full Changelog**: https://github.com/hbakri/django-ninja-crud/compare/v0.4.1...v0.5.0

0.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](https://github.com/hbakri/django-ninja-crud/compare/v0.4.0...v0.4.1)

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

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.