Skip to main content

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 creation of CRUD 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.

Note: This pre-release (alpha) version supports only JSON data. multipart/form-data (file uploads) is not yet available. For ImageField or FileField, use the full URL as a string.


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 CRUD 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_create and after_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lazy_ninja-0.6.1.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lazy_ninja-0.6.1-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file lazy_ninja-0.6.1.tar.gz.

File metadata

  • Download URL: lazy_ninja-0.6.1.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lazy_ninja-0.6.1.tar.gz
Algorithm Hash digest
SHA256 4446b638b3bc29da0deb3966992e5d1ebef709a373656f03ba0e720fe4651789
MD5 fb754f9b86f52ab5738ec5bd34823404
BLAKE2b-256 0f0a94b3b13d06e052de2430d80379956885ef8d7a889a5a8b7c02d11550e1cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for lazy_ninja-0.6.1.tar.gz:

Publisher: python-publish.yml on AghastyGD/lazy-ninja

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lazy_ninja-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: lazy_ninja-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lazy_ninja-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 000ccb7c03ef249970f30bc68d7dd40ead1f8f0e0a23add08e0c62c35bb3f146
MD5 edd53497e91334a6d1c00f0bd772c196
BLAKE2b-256 f4ab594fed78fcb35f8759d712f726cb783516415971f02006e0ad53425f60ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for lazy_ninja-0.6.1-py3-none-any.whl:

Publisher: python-publish.yml on AghastyGD/lazy-ninja

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page