Skip to main content

Django Basic Crud Generator

PyPI

  • Django Basic CRUD Generator is a simple python script to generate views, templates and tests files for a given Django Model.
  • The Script will generate the following files, using as base these templates files
├── APP_NAME
│   ├── templates
│   │   ├── MODEL_NAME
│   │   │   ├── MODEL_NAME_list.html
│   │   │   ├── MODEL_NAME_create.html
│   │   │   ├── MODEL_NAME_detail.html
│   │   │   ├── MODEL_NAME_update.html
│   │   │   ├── MODEL_NAME_delete.html
│   ├── tests
│   │   ├── MODEL_NAME
│   │   │   ├── __init__.py
│   │   │   ├── MODEL_NAME_list_test.py
│   │   │   ├── MODEL_NAME_create_test.py
│   │   │   ├── MODEL_NAME_detail_test.py
│   │   │   ├── MODEL_NAME_update_test.py
│   │   │   ├── MODEL_NAME_delete_test.py
│   ├── views
│   │   ├── MODEL_NAME
│   │   │   ├── __init__.py
│   │   │   ├── MODEL_NAME_list.py
│   │   │   ├── MODEL_NAME_create.py
│   │   │   ├── MODEL_NAME_detail.py
│   │   │   ├── MODEL_NAME_update.py
│   │   │   ├── MODEL_NAME_delete.py
│   │── urls.py

Installation:

Download the repository

git clone https://github.com/J-hanks/django_basic_crud_generator.git

Install using pip

pip install django_basic_crud_generator

Usage:

You can call the script anywhere set app_name and model_name options are Required

python -m django_basic_crud_generator --app_name MY_APP --model_name MY_MODEL

You can also import in your python scripts to generate files programatically.

import django_basic_crud_generator
django_basic_crud_generator.generate_files(
    app_name="MyApp",
    model_name="MyModel",
    use_template_layout=True,
    override_templates="MyTemplatesFolder/"
)

Options:

  • --app_name: Your Django application name
  • --model_name: Your Django model name you want crud generated
  • --use_template_layout: Set this flag to system render templates files using this layout file
  • --override_templates: Set the override templates folder. Ex: --override_templates MY_TEMPLATES_FOLDER

Manually fix urls file:

  • The urls.py file will need mannualy inspection
  • Make sure you included you app urls in your project level urls.py file.
  • If you only use project level, copy the contents of generated app urls.py to your project level urls.py file

Examples

You can see examples of generated files here

Metadata

Release files for Django-Basic-CRUD-Generator 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Django-Basic-CRUD-Generator 0.2
File Size Uploaded
Django Basic CRUD Generator-0.2.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Django-Basic-CRUD-Generator 0.2
File Interpreter ABI Platform
Django_Basic_CRUD_Generator-0.2-py3-none-any.whl Python 3 none any Details

Total release size: 22.7 kB

Release files / Django Basic CRUD Generator-0.2.tar.gz

Download URL Django Basic CRUD Generator-0.2.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
94443b31c4f426c5e8d17dd3245c32bc5ae629918842c6ddd9cd92281e7bfe5f
BLAKE2b-256 checksum
How to use checksums
e072e169634bda8d65c0953d927dcf32722848627be405b3b1824165305d3d7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release files / Django_Basic_CRUD_Generator-0.2-py3-none-any.whl

Download URL Django_Basic_CRUD_Generator-0.2-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcb254767fd814524674b8a0b33320f3903dca23bf4815e7f2064e173995c232
BLAKE2b-256 checksum
How to use checksums
914e03c2bd91343dad91c4997098e60a3ba985fa949e2c437f72fac18676b668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page