Generate Mermaid ER diagrams and data dictionaries from Django models
Project description
django-er-mermaid
Generate Mermaid ER diagrams and data dictionaries from Django models.
Features
- Mermaid ER Diagram: Generate ER diagrams in Mermaid syntax with
help_textannotations - Data Dictionary: Auto-generate comprehensive data dictionary tables
- Deprecation Warnings: Detect deprecated patterns like
ForeignKey(unique=True)andunique_together - Flexible Output: Write to file or stdout
Installation
pip install django-er-mermaid
Add django_er_mermaid to your INSTALLED_APPS:
INSTALLED_APPS = [
'django_er_mermaid',
# ... your other apps
]
Usage
Basic Usage
# Generate ER diagram to docs/er-diagram.md (default)
python manage.py generate_er
# Specify output file
python manage.py generate_er -o output.md
# Print to stdout
python manage.py generate_er --to-stdout
Target Specific Apps
# Single app
python manage.py generate_er -a myapp
# Multiple apps
python manage.py generate_er -a app1,app2,app3
Deprecation Warnings
# Include warnings in markdown output
python manage.py generate_er -w
# Include warnings in Japanese
python manage.py generate_er -w -j
Detects the following deprecated patterns:
ForeignKey(unique=True)� UseOneToOneFieldinsteadunique_together� UseUniqueConstraintinstead
Output Example
ER Diagram (Mermaid)
erDiagram
User {
bigint id PK
varchar username "Username for login"
varchar email "Email address"
}
Profile {
bigint id PK
bigint user_id FK
text bio "User biography"
}
User ||--|| Profile : "user"
Data Dictionary
| Field | Type | PK | FK | Null | Unique | Description |
|---|---|---|---|---|---|---|
| id | bigint | |||||
| username | varchar | Username for login | ||||
| varchar | Email address |
Options
| Option | Short | Description |
|---|---|---|
--apps |
-a |
Target apps (comma-separated). Default: all project apps |
--output |
-o |
Output file path. Default: docs/er-diagram.md |
--to-stdout |
Print to stdout instead of file | |
--include-warnings |
-w |
Include deprecation warnings in markdown |
--japanese |
-j |
Output warnings in Japanese (requires -w) |
Requirements
- Python >= 3.13
- Django >= 5.0
License
MIT License - see LICENSE for details.
Credits
This project was inspired by django-erd-generator by Andryo Marzuki.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_er_mermaid-0.1.0.tar.gz.
File metadata
- Download URL: django_er_mermaid-0.1.0.tar.gz
- Upload date:
- Size: 40.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53ac158d2f7bf799411ca00ddf1c41fe04cd8b195a8cd63167fd74e200219fd7
|
|
| MD5 |
eb0a0854dc1aadfb8653637224aaf299
|
|
| BLAKE2b-256 |
5202d7448a2ab6f5e8f6083f5802612f0516757fb74450576efd1b763fae7180
|
File details
Details for the file django_er_mermaid-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_er_mermaid-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56d20075ea3a664320dd3c31f0ae193bccb67d9993e9a991d8e0e01f1f3d0005
|
|
| MD5 |
7bfbc0c81c1fbc936fa5fe9eacd7c13d
|
|
| BLAKE2b-256 |
90444dac9f4d90b42c2e0e37b6e0c932d814384efbe73ad9697d59632ab83e48
|