Django utilities for codegen and DX improvement
Project description
Django hogwarts 🧙♂️
Management commands to generate views, urls and templates
Use CLI commands to generate:
- basic create, update, list, detail views
- urlpatterns from views with REST like path urls
- form, table, detail templates (Bootstrap and django-crispy-forms by default)
all commands does not remove or override existing views, paths and templates
Installation
# pip
pip install django-hogwarts
# poetry
poetry add --dev django-hogwarts
add hogwarts
to your INSTALLED_APPS
:
INSTALLED_APPS = [
...
"hogwarts"
]
Usage
Check this to know what urls will be generated
Generate urls.py
python manage.py genurls <your-app-name>
Arguments:
--force-app-name
,fan
override app_name in urls.py
Generate views.py
Check demo
python manage.py genviews <your-app-name> <model-name>
Arguments
smart-mode
,-s
adds login required, sets user for CreateView and checks if client is owner of object in UpdateViewmodel-is-namespace
,-mn
adds success_url with name model as namespace
Generate templates
django-crispy-forms and crispy-bootstrap5 packages are required
python manage.py gentemplates <your-app-name>
Want to create own scaffolding templates?
- create folder, copy and customize from this templates
- add that folder to setting
HOGWARTS_SCAFFOLD_FOLDER = "<your-folder>"
Roadmap
- tests generator
- scaffolding all views, urls and templates from a single command
- maybe rest-framework support (let me know in issues)
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
django-hogwarts-0.5.0.tar.gz
(17.1 kB
view hashes)
Built Distribution
Close
Hashes for django_hogwarts-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c32391baea4846c882d94bee255bedac1a0e27b192e7e41ee5680bad22ccf561 |
|
MD5 | fa784daa4bb90c10b14bf01a8e092c8f |
|
BLAKE2b-256 | 27d1a122d8d2d2c583d9b20106f0840d088ed034ca703b5fb5cd9a7b1c094e17 |