uml2django
uml2django is a tool for generate Django code from PlantUML class diagrams. It able to generate:
Models
Forms
Class Based Views
Templates
Tests
Quick start
Installation
Install via pip:
pip install uml2django
Download from github:
git clone https://github.com/J-hanks/uml2django
Running
From command line:
uml2django --puml my_plant_uml_class_diagram.puml
Import as script:
from uml2django.settings import settings from uml2django import objects from uml2django import load_data_from PLANT_UML_FILE = "school_management_project.puml" load_data_from(plantuml_file_path=PLANT_UML_FILE) for django_model in objects.DJANGO_MODELS: django_model.generate_model_python_file() if not django_model.is_abstract: django_model.generate_rest_api() django_model.generate_model_forms() django_model.generate_class_based_views() django_model.generate_cbv_urls_routing() django_model.generate_templates()
Syntax
Apps
To represent an Django App, use the PlantUML package tag.
The app name must follow pep8: Modules and packages should have short, all-lowercase names. Underscores can be used if it improves readability, although the use of underscores is discouraged.:
@startuml package exampledjangoapp { } package example_django_app { } @enduml
Models
Use PlantUML class tag to represent an Django Model.
The Model name must follow pep8 : where stands that class names should normally use the CapWords convention.
All classes defined MUST BE inside an package, like models inside Django apps.:
@startuml package exampledjangoapp { class MyFirstModel { } } package example_django_app { class MySecondModel { } } @enduml
Models Inheritance
-
@startuml package exampledjangoapp { abstract class BaseModel { {field} name : CharField(max_length=30) } class ExtendedModel { {field} name : CharField(max_length=30) } BaseModel <-- ExtendedModel : inherit } @enduml
Models Relashionships
Model Fields
Use PlantUML {field} tag to represent an Django model field.
If the field type is not informed, uml2django define it as CharField.:
@startuml package exampledjangoapp { class MyFirstModel { {field} char_field : CharField(max_length=30) {field} other_char_field } } package example_django_app { class MySecondModel { {field} integer_field : IntegerField() } } @enduml
Metadata
Release files for uml2django 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| uml2django-0.0.8.tar.gz | 64.3 kB | Without provenance | Details for uml2django-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| uml2django-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for uml2django-0.0.8-py3-none-any.whl |
Total release size: 101.1 kB
Release files / uml2django-0.0.8.tar.gz
| Download URL | uml2django-0.0.8.tar.gz |
|---|---|
| Size | 64.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47ed6626777c7a7b78ea39956e42464eed4cf4a2534020adf400a6ea77d475f2
|
|
BLAKE2b-256 checksum How to use checksums |
487df2170c63e2a68de58a50803401d5bec2e0c8993a0ba5ee41ad0fc0eb9d89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Release files / uml2django-0.0.8-py3-none-any.whl
| Download URL | uml2django-0.0.8-py3-none-any.whl |
|---|---|
| Size | 36.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b77cfaeabda187125132d6154de4562afd6bac3d472d44b308d4011bf684860
|
|
BLAKE2b-256 checksum How to use checksums |
a73bedc062b13b7fa29df2ff2efc49fb3425436a133c09fbfad500ebd61a3aae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Security for uml2django 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.