Skip to main content

A Django app to provide information about models

Project description

django-model-info

PyPI version Build Status codecov

Instantly understand your Django models' structure and relationships with beautiful, intuitive output.

Working with complex Django projects? Need to quickly understand model relationships and fields? django-model-info is an ideal solution for diving into any Django codebase with confidence.

Why django-model-info?

  • Perfect for New Team Members: Quickly understand existing codebases without diving through multiple files
  • Great for Documentation: Export beautiful HTML or Markdown documentation of your models' structure
  • Ideal for Large Projects: Filter by app or model to focus on what matters
  • Time-Saving: Instantly see all fields, relationships, and methods in one place
  • Rich Output: Leverages rich for beautiful, clear console output

See an example of the HTML output or the Markdown Output.

Quick Start

  1. Install the package:
pip install django-model-info
  1. Add to INSTALLED_APPS:
INSTALLED_APPS = (
    ...
    'django_model_info.apps.DjangoModelInfoConfig',
    ...
)
  1. Run the command:
python manage.py model_info

That's it! You'll see a beautiful overview of all your models.

Key Features

  • Multiple Output Levels: Choose from 4 verbosity levels to see exactly what you need

    • Level 0: Just model names
    • Level 1: Fields and basic method names
    • Level 2: Detailed field info and method signatures
    • Level 3: Complete information including docstrings and source locations
  • Smart Filtering: Focus on specific apps or models:

python manage.py model_info -f myapp myapp.SpecificModel
  • Export Options: Generate documentation in multiple formats:
python manage.py model_info -e documentation.html  # HTML output
python manage.py model_info -e documentation.md    # Markdown output
  • Print Markdown to screen: As an alternative to the rich output:
python manage.py model_info --markdown
  • Rich or Markdown Information Display:
    • Field types and database representations
    • Relationship mappings (forward and reverse)
    • Method signatures and locations
    • Database details (table names, indexes, etc.)
    • Source file locations and line numbers

Configuration

Optionally configure defaults in your Django settings:

# Default verbosity level (0-3)
MODEL_INFO_VERBOSITY = 2

# Default models/apps to display
MODEL_INFO_FILTER = ["myapp", "otherapp.SpecificModel"]

Documentation

For detailed usage and examples, visit our full documentation.

Roadmap

  • List manager and queryset methods
  • Include signals and other model-level methods
  • Add MermaidJS support for visualizing relationships

Contributing

We welcome contributions! This project uses:

License

MIT License

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

django_model_info-2024.11.1.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

django_model_info-2024.11.1-py2.py3-none-any.whl (18.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django_model_info-2024.11.1.tar.gz.

File metadata

File hashes

Hashes for django_model_info-2024.11.1.tar.gz
Algorithm Hash digest
SHA256 e88ffc17fae0d7f6503125b4e4a64f44ad85ef30d55423fc5c92835d8dbd5ca0
MD5 8658784f979e28af08bdc6a30891ffca
BLAKE2b-256 48d28ffa4717352bb9c99bad79ac87ae837918a78f42e6543e595ffbe498a39c

See more details on using hashes here.

File details

Details for the file django_model_info-2024.11.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_model_info-2024.11.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 96519634832722b2a12ddbd226f8b5c03b9e1dab492c5c4e036d817e77e53ce9
MD5 c04bdf3e199d17a245b1ec5c0c8a45a7
BLAKE2b-256 085cab9a8ed2ff1149490604c1f4789d4011be705c0848f4efab5ef5e99d0269

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page