Rapidly generate CRUD API endpoints for your Django models with Django Ninja. Includes dynamic schema generation and customizable hooks.
Project description
Lazy Ninja
Lazy Ninja is a Django library that simplifies the generation of API endpoints using Django Ninja. It dynamically scans your Django models and generates Pydantic schemas for listing, retrieving, creating, and updating records. The library also allows you to customize behavior through hook functions (controllers) and schema configurations.
By leveraging Django Ninja, Lazy Ninja provides automatic, interactive API documentation via OpenAPI, making it easy to visualize and interact with your endpoints.
Installation
Install Lazy Ninja via pip:
pip install lazy-ninja
For contributors or those who want the latest code, install from source:
git clone https://github.com/AghastyGD/lazy-ninja.git
cd lazy-ninja
pip install -r requirements.dev.txt
pip install -e .
Quick Start
Here’s a simple example of integrating Lazy Ninja into your Django project:
from ninja import NinjaAPI
from lazy_ninja.builder import DynamicAPI
api = NinjaAPI()
auto_api = DynamicAPI(api)
auto_api.init()
Add api.urls to your urls.py to expose the endpoints.
Features
- Automatic Endpoints: Instantly generate API routes for your Django models.
- Dynamic Schema Generation: Automatically create Pydantic schemas for your models.
- Custom Controllers: Customize route behavior with hooks like
before_createandafter_update. - Built-in Filtering, Sorting, and Pagination: Simplify data handling with query parameters.
- Interactive Documentation: Swagger UI and ReDoc support out of the box.
Roadmap
- Basic CRUD operations
- Asynchronous support
- Filtering, sorting, and pagination
- File upload support
- Authentication and RBAC
- Advanced model relationships
Contributing
Contributions are welcome! Feel free to fork the repository and submit a pull request with any improvements or bug fixes.
License
This project is licensed under the MIT License.
See the LICENSE file for details and full license text.
Learn More
For complete documentation, including advanced usage, configuration options, and examples, visit the Lazy Ninja Documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lazy_ninja-0.6.7.tar.gz.
File metadata
- Download URL: lazy_ninja-0.6.7.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f921097fe10c5006eb3856625fda4e47abaf0a5bdfe3e1924abfa659b94b92f
|
|
| MD5 |
a5503f8effa8bb9cf96891abbf58cdae
|
|
| BLAKE2b-256 |
0b16aa6f728d16acff65e08940a0a75bd0e4fdb31e7c6407af0eb2c8d08e9e26
|
Provenance
The following attestation bundles were made for lazy_ninja-0.6.7.tar.gz:
Publisher:
python-publish.yml on AghastyGD/lazy-ninja
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lazy_ninja-0.6.7.tar.gz -
Subject digest:
2f921097fe10c5006eb3856625fda4e47abaf0a5bdfe3e1924abfa659b94b92f - Sigstore transparency entry: 543495406
- Sigstore integration time:
-
Permalink:
AghastyGD/lazy-ninja@929e732593c6d43307c76c8edad35b28c6241418 -
Branch / Tag:
refs/tags/v0.6.7 - Owner: https://github.com/AghastyGD
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@929e732593c6d43307c76c8edad35b28c6241418 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lazy_ninja-0.6.7-py3-none-any.whl.
File metadata
- Download URL: lazy_ninja-0.6.7-py3-none-any.whl
- Upload date:
- Size: 39.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cededb8e043f4d3055a79ce8d3d8c3a2534f7526fc1ac1839b81b7dd60bc824
|
|
| MD5 |
a476f874b32b136fb131d1457be8daf1
|
|
| BLAKE2b-256 |
67cbc9e01ec12e414065527b26bca2a1fadfb4da12f31cf837a2a723d9785d0a
|
Provenance
The following attestation bundles were made for lazy_ninja-0.6.7-py3-none-any.whl:
Publisher:
python-publish.yml on AghastyGD/lazy-ninja
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lazy_ninja-0.6.7-py3-none-any.whl -
Subject digest:
6cededb8e043f4d3055a79ce8d3d8c3a2534f7526fc1ac1839b81b7dd60bc824 - Sigstore transparency entry: 543495424
- Sigstore integration time:
-
Permalink:
AghastyGD/lazy-ninja@929e732593c6d43307c76c8edad35b28c6241418 -
Branch / Tag:
refs/tags/v0.6.7 - Owner: https://github.com/AghastyGD
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@929e732593c6d43307c76c8edad35b28c6241418 -
Trigger Event:
release
-
Statement type: