Skip to main content

Automatic CRUD API generator for Django models using DRF, dynamic and reusable.

Project description

andleeb-drf-auto-crud

Automatic CRUD API generator for Django models using Django REST Framework (DRF).

This package simplifies the creation of REST APIs for your Django models. Once installed, it dynamically generates:

  • Serializers for all your models
  • ViewSets with complete CRUD operations
  • URL patterns ready to integrate into Django's urlpatterns

The package is designed to be minimal and intuitive. You only need to work with two modules in your app:

  1. model.py – for defining your models
  2. url.py – for automatically generating URLs for your models

This allows you to spend less time writing repetitive boilerplate and more time focusing on your business logic.


model.py – Base Model for Automatic CRUD

The model.py module provides a base model class that you can extend for all your Django models.

Instead of manually defining database table names and plural verbose names, this base class handles it automatically:

  • Converts your model class names to snake_case table names
  • Automatically generates plural verbose names for improved admin readability
  • Maintains full compatibility with Django ORM

Basic Usage

from django.db.models import CharField
from andleeb_drf_auto_crud.model import Model

class MyModel(Model):
    name = CharField(max_length=50, unique=True)
    def __str__(self):
        return self.name

url.py – Automatic URL Generation for CRUD

The url.py module provides a simple way to automatically generate DRF URL patterns for all models in your app. It eliminates the need to manually write ViewSet routes for each model.

Key Features

  • Automatically registers ViewSets for all models in the app
  • Provides a dynamic endpoint for filtered queries on any model
  • Ready to integrate into your Django urlpatterns without additional configuration

Basic Usage

from django.urls import path, include
from andleeb_drf_auto_crud.url import get_drf_auto_urlpatterns
urlpatterns = get_drf_auto_urlpatterns()

Installation

pip install andleeb-drf-auto-crud

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

andleeb_drf_auto_crud-1.0.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

andleeb_drf_auto_crud-1.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file andleeb_drf_auto_crud-1.0.1.tar.gz.

File metadata

  • Download URL: andleeb_drf_auto_crud-1.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for andleeb_drf_auto_crud-1.0.1.tar.gz
Algorithm Hash digest
SHA256 dc93eab88bf6282c7819806129cf295ed92a41f1831fd2c346e6879790df1962
MD5 2e5c0de0a7ac77701eb07bd40caae35c
BLAKE2b-256 617265eb13b1c3064d259fd359a4c0660c8f8c9fbc49db41050420cf27a7222f

See more details on using hashes here.

File details

Details for the file andleeb_drf_auto_crud-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for andleeb_drf_auto_crud-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60f928e5b7f9f718e2ed6dfe6d3b05ebc7e69a42689d26966835690cbaeb7ced
MD5 077233f8e92c7867367db0f5be333dfd
BLAKE2b-256 6ce64371150f8e195c1bbad69539612ad5cf5144000f106ee486a9ade20e57fe

See more details on using hashes here.

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