django-orm-lens

Django ORM Lens β€” live sidebar and ER diagram for your Django models

# Django ORM Lens ### See your entire Django schema β€” in your editor, in your terminal, and from your AI agent. Every app. Every model. Every field. Every relationship. Grouped, navigable, and one keystroke away from a live ER diagram.
[![Install from Marketplace](https://img.shields.io/badge/VS_Code-Install-0c4b33?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens) [![PyPI](https://img.shields.io/badge/PyPI-pip_install-3775a9?style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/django-orm-lens/) [![MCP Registry](https://img.shields.io/badge/MCP_Registry-listed-6f42c1?style=for-the-badge)](https://registry.modelcontextprotocol.io/) [![Glama](https://img.shields.io/badge/Glama-listed-0f172a?style=for-the-badge)](https://glama.ai/mcp/servers/FROWNINGdev/django-orm-lens) [![mcp.so](https://img.shields.io/badge/mcp.so-listed-1f2937?style=for-the-badge)](https://mcp.so/servers/django-orm-lens) [![Star on GitHub](https://img.shields.io/badge/β˜…-Star_on_GitHub-24292f?style=for-the-badge&logo=github&logoColor=white)](https://github.com/FROWNINGdev/django-orm-lens) [![Sponsor](https://img.shields.io/badge/β™₯-Sponsor-db61a2?style=for-the-badge&logo=githubsponsors&logoColor=white)](https://github.com/sponsors/FROWNINGdev)
[![Version](https://img.shields.io/visual-studio-marketplace/v/frowningdev.django-orm-lens?color=0c4b33&label=extension&logo=visualstudiocode)](https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens) [![Installs](https://img.shields.io/visual-studio-marketplace/i/frowningdev.django-orm-lens?color=0c4b33&label=installs)](https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens) [![Rating](https://img.shields.io/visual-studio-marketplace/r/frowningdev.django-orm-lens?color=0c4b33&label=rating)](https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens&ssr=false#review-details) [![PyPI version](https://img.shields.io/pypi/v/django-orm-lens?color=3775a9&label=pypi)](https://pypi.org/project/django-orm-lens/) [![Python](https://img.shields.io/pypi/pyversions/django-orm-lens?color=3775a9)](https://pypi.org/project/django-orm-lens/) [![License MIT](https://img.shields.io/badge/license-MIT-0c4b33?style=flat)](LICENSE) [![CI](https://github.com/FROWNINGdev/django-orm-lens/actions/workflows/ci.yml/badge.svg)](https://github.com/FROWNINGdev/django-orm-lens/actions/workflows/ci.yml)

🎯 Pick your path

Django ORM Lens ships as three distributions on one core β€” pick the one that matches your workflow. Each takes under 60 seconds.

Editor user (VS Code / Cursor / Windsurf): install the extension β†’ open any Django project β†’ sidebar tree + ER diagram appear.

code --install-extension frowningdev.django-orm-lens

Terminal / CI user: install from PyPI β†’ run django-orm-lens in any directory that contains Django apps.

pip install django-orm-lens
django-orm-lens               # welcome + commands
django-orm-lens scan          # scan cwd for apps and models

AI coding agent user (Cursor / Aider / Continue / Zed): install with MCP extras β†’ add one JSON block to your client config.

pip install "django-orm-lens[mcp]"

Then the MCP config snippet in the Integrations section below. Point DJANGO_ORM_LENS_ROOT at your Django project’s absolute path.


πŸ“Š Traction

[![First-week installs](https://img.shields.io/badge/first--week_installs-1814-3775a9?style=for-the-badge&logo=pypi&logoColor=white&labelColor=1e293b)](https://pypi.org/project/django-orm-lens/) [![Peak day](https://img.shields.io/badge/peak_day_installs-441-f97316?style=for-the-badge&logo=rocket&logoColor=white&labelColor=1e293b)](https://pypi.org/project/django-orm-lens/) [![Unique cloners](https://img.shields.io/badge/unique_cloners_14d-279-24292f?style=for-the-badge&logo=github&logoColor=white&labelColor=1e293b)](https://github.com/FROWNINGdev/django-orm-lens) [![VS Code rating](https://img.shields.io/badge/VS_Code_rating-5.0_%E2%98%85-eab308?style=for-the-badge&logo=visualstudiocode&logoColor=white&labelColor=1e293b)](https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens)
[![VS Code downloads](https://img.shields.io/badge/VS_Code_downloads-113-0c4b33?style=for-the-badge&logo=visualstudiocode&logoColor=white&labelColor=1e293b)](https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens) [![GitHub views](https://img.shields.io/badge/GitHub_views_14d-381-24292f?style=for-the-badge&logo=github&logoColor=white&labelColor=1e293b)](https://github.com/FROWNINGdev/django-orm-lens) [![LinkedIn posts](https://img.shields.io/badge/LinkedIn_posts_live-6-0a66c2?style=for-the-badge&logo=linkedin&logoColor=white&labelColor=1e293b)](https://linkedin.com/company/django-orm-lens) [![Awesome-list PRs](https://img.shields.io/badge/awesome--list_PRs-3_pending-16a34a?style=for-the-badge&logo=awesomelists&logoColor=white&labelColor=1e293b)](https://github.com/FROWNINGdev)
[![PyPI weekly](https://img.shields.io/pypi/dw/django-orm-lens?style=for-the-badge&logo=pypi&logoColor=white&label=weekly%20downloads&labelColor=1e293b&color=3775a9)](https://pypi.org/project/django-orm-lens/) [![PyPI monthly](https://img.shields.io/pypi/dm/django-orm-lens?style=for-the-badge&logo=pypi&logoColor=white&label=monthly%20downloads&labelColor=1e293b&color=3775a9)](https://pypi.org/project/django-orm-lens/) [![GitHub stars](https://img.shields.io/github/stars/FROWNINGdev/django-orm-lens?style=for-the-badge&logo=github&logoColor=white&label=stars&labelColor=1e293b&color=eab308)](https://github.com/FROWNINGdev/django-orm-lens/stargazers) [![GitHub forks](https://img.shields.io/github/forks/FROWNINGdev/django-orm-lens?style=for-the-badge&logo=github&logoColor=white&label=forks&labelColor=1e293b&color=64748b)](https://github.com/FROWNINGdev/django-orm-lens/network/members)
[![MCP Registry](https://img.shields.io/badge/MCP_Registry-official_listing-6f42c1?style=for-the-badge&labelColor=1e293b)](https://registry.modelcontextprotocol.io/) [![CodeTriage](https://img.shields.io/codetriage/help-wanted-issues/FROWNINGdev/django-orm-lens?style=for-the-badge&label=CodeTriage%20helpers&labelColor=1e293b&color=2ec4b6)](https://www.codetriage.com/frowningdev/django-orm-lens) [![Glama.ai](https://img.shields.io/badge/Glama.ai-listed-0f172a?style=for-the-badge&labelColor=1e293b)](https://glama.ai/mcp/servers/FROWNINGdev/django-orm-lens) [![mcp.so](https://img.shields.io/badge/mcp.so-listed-1f2937?style=for-the-badge&labelColor=1e293b)](https://mcp.so/servers/django-orm-lens)
[![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/frowningdev.django-orm-lens?style=for-the-badge&logo=visualstudiocode&logoColor=white&label=VS%20Code&labelColor=1e293b&color=0c4b33)](https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens) [![PyPI version](https://img.shields.io/pypi/v/django-orm-lens?style=for-the-badge&logo=pypi&logoColor=white&label=PyPI&labelColor=1e293b&color=3775a9)](https://pypi.org/project/django-orm-lens/) [![Python](https://img.shields.io/pypi/pyversions/django-orm-lens?style=for-the-badge&logo=python&logoColor=white&label=Python&labelColor=1e293b&color=3775a9)](https://pypi.org/project/django-orm-lens/) [![Django](https://img.shields.io/badge/Django-4.0_%E2%80%93_5.1-092e20?style=for-the-badge&logo=django&logoColor=white&labelColor=1e293b)](https://www.djangoproject.com/) [![License MIT](https://img.shields.io/badge/license-MIT-16a34a?style=for-the-badge&labelColor=1e293b)](LICENSE)

Updated 2026-07-15. PyPI weekly / monthly, GitHub stars / forks, and PyPI / VS Code version badges auto-refresh live.

If the tool saves you a grep next time you touch a strange Django project β€” star helps others find it.


⚑ Install

VS Code / Cursor / Windsurf / any Code fork:

code --install-extension frowningdev.django-orm-lens

Or search Django ORM Lens in the Extensions view.

Terminal & AI coding agents:

pip install django-orm-lens              # CLI only
pip install "django-orm-lens[mcp]"       # + MCP server for AI agents

Requires Python 3.9+. Zero runtime dependencies for the CLI.


🎯 The problem

Works offline. Works on a broken venv. Works on someone else’s laptop. Works in CI.

You open a Django project. It has 20 apps. You need to answer a simple question:

β€œWhich app owns the Order model, and how is it connected to User?”

Today, that means: Ctrl+P, β€œmodels”, scroll through 30 hits, open five files, Ctrl+F for class Order, read through 400 lines of ForeignKey('otherapp.Something') strings, try to remember what you learned two files ago.

Half a day gone. Every time. On every project.


✨ With Django ORM Lens

### πŸ“š A tree of everything Every app β†’ every model β†’ every field β†’ every `Meta` option. Grouped by application, sorted alphabetically, expandable. Icons distinguish `CharField` from `ForeignKey` from `ManyToManyField` at a glance. ### πŸ•ΈοΈ A live ER diagram One command opens a Mermaid entity-relationship diagram of your entire schema. Watch it redraw as you edit. Export to SVG. `ForeignKey`, `OneToOneField`, and `ManyToManyField` become proper cardinality arrows.
### πŸ”Ž Hover for relations Hover over `ForeignKey('app.Model')` in any Python file β†’ a card pops up with the target model's fields, relations, and a "Jump to" link. No `Ctrl+F`, no file dialog. ### 🧭 Jump-to-definition Click any field in the tree β†’ cursor lands on the exact line. Filter the tree by app or model name. Split `models/` packages are fully supported.
### ⚑ Zero configuration No `DJANGO_SETTINGS_MODULE`. No `runserver`. Parses `models.py` statically. Works with a broken venv, a missing dependency, or on someone else's laptop. ### 🎨 Native VS Code UI Dark theme. Light theme. Your theme. Follows your icon theme, your font, your key bindings. Nothing garish, nothing branded.


πŸ“Έ What it looks like

Django ORM Lens sidebar showing an app's models with fields, relations, and Meta options

Also included in the extension:


πŸ€– For terminals and AI coding agents

The same parser that powers the VS Code extension ships as a standalone Python package β€” with an optional MCP (Model Context Protocol) server so any MCP-compatible AI agent can navigate your Django schema without importing Django or booting your app.

CLI

django-orm-lens scan -f json          # every app, every model, every field
django-orm-lens describe blog.Post    # one model in Markdown
django-orm-lens hover blog.Post       # compact hover card
django-orm-lens list | fzf            # flat app.Model β€” pipes anywhere
django-orm-lens er > schema.mmd       # Mermaid ER diagram

Every command accepts --path <dir> and --exclude <glob>.

MCP server

Register it once with your agent and it exposes five read-only tools:

Tool Purpose
list_apps Every Django app in the workspace with model counts
list_models Flat app.Model list, optional app filter
describe_model Full field / relation / Meta detail for one model
find_relations Inbound + outbound relations for one model
er_diagram Mermaid erDiagram for the whole workspace
# Start it directly
django-orm-lens-mcp

# Or via the CLI subcommand
django-orm-lens mcp

Set DJANGO_ORM_LENS_ROOT=/abs/path/to/project to point it anywhere.


πŸ”Œ Integrations

Client How to enable Status
VS Code code --install-extension frowningdev.django-orm-lens βœ…
Cursor same VSIX + optional MCP entry in ~/.cursor/mcp.json βœ…
Windsurf / VSCodium / any Code fork install the VSIX from the Marketplace or GitHub Releases βœ…
Aider add django-orm-lens-mcp to your mcp.json βœ… (via MCP)
Continue.dev register the MCP server in ~/.continue/config.json βœ… (via MCP)
Zed register the MCP server in Zed settings βœ… (via MCP)
Any MCP-compatible client point command at django-orm-lens-mcp, set DJANGO_ORM_LENS_ROOT βœ…
Discoverable via MCP Registry official Model Context Protocol server directory βœ…
Plain terminal / CI pip install django-orm-lens && django-orm-lens scan βœ…

Example: Cursor / any MCP client

{
  "mcpServers": {
    "django-orm-lens": {
      "command": "django-orm-lens-mcp",
      "env": { "DJANGO_ORM_LENS_ROOT": "/abs/path/to/your/project" }
    }
  }
}


πŸš€ Get started (30 seconds)

In VS Code:

  1. code --install-extension frowningdev.django-orm-lens
  2. Open a folder with a manage.py or models.py
  3. Click the Django ORM Lens icon in the activity bar
  4. Expand apps β†’ models β†’ fields
  5. Click the type-hierarchy icon at the top of the panel β†’ ER diagram opens beside your code

In a terminal:

pip install django-orm-lens
cd my-django-project
django-orm-lens scan -f table

As an AI agent tool:

pip install "django-orm-lens[mcp]"

…then register django-orm-lens-mcp in your agent’s MCP config (see the Integrations table above).

No settings screen. No sign-in. No telemetry.


🎯 Who this is for


πŸ—ΊοΈ Market position

Django ORM Lens sits at the intersection of editor tooling and AI-agent tooling β€” a slot no existing package covers:

Segment Existing option What it costs you
Boot-and-graph django-extensions graph_models Requires Graphviz + Django settings + a working DB URL
Web-based viewer django-schema-graph Requires a running Django server; hosts one more thing to break
Admin panel Django Admin Requires runserver + auth + database β€” great for data, not for architecture
Editor plugin PyCharm’s Django Structure Locked to PyCharm; no CLI, no AI-agent story
MCP server (none until now) AI agents guess your schema from source, imperfectly

Django ORM Lens is the only tool that ships three surfaces from one parser: a VS Code extension (any Code fork), a zero-dep CLI (terminals + CI), and an MCP server (AI agents). All static. All free. All MIT.


πŸ€” How is this different?

Β  Django ORM Lens django-extensions graph_models django-schema-graph Django Admin PyCharm Django Structure
Works without a bootable Django project βœ… ❌ ❌ ❌ ⚠️
Zero-install (no graphviz, no server) βœ… ❌ ❌ ❌ ❌ (needs PyCharm)
Works in VS Code / Cursor / any Code fork βœ… ❌ ❌ ❌ ❌
Sidebar tree inside the editor βœ… ❌ ❌ ❌ βœ…
Live ER diagram βœ… βœ… βœ… ❌ ❌
Hover cards on ForeignKey βœ… ❌ ❌ ❌ ⚠️
CodeLens on model classes βœ… ❌ ❌ ❌ ❌
Split models/ package support βœ… ⚠️ ⚠️ βœ… βœ…
CLI for terminal / CI βœ… ⚠️ ❌ ❌ ❌
MCP server for AI agents βœ… ❌ ❌ ❌ ❌
Discoverable in the MCP Registry βœ… ❌ ❌ ❌ ❌
Free & open-source (MIT) βœ… βœ… βœ… βœ… ❌ (paid IDE)
Django version support 4.0 – 5.2 latest 3.2 – 4.1 (stale since 2023) latest latest

django-schema-graph has not been updated since 2023-05 and does not test Django 5.x.


βš™οΈ Configuration

The defaults are opinionated and sensible. If you need to tweak:

// .vscode/settings.json
{
  "djangoOrmLens.excludeGlobs": [
    "**/migrations/**",
    "**/node_modules/**",
    "**/venv/**",
    "**/.venv/**",
    "**/env/**"
  ],
  "djangoOrmLens.autoRefresh": true
}
Setting Type Default What it does
djangoOrmLens.excludeGlobs string[] See above Glob patterns to skip when scanning
djangoOrmLens.autoRefresh boolean true Rescan on models.py changes


🧭 Commands

Open the command palette (Ctrl+Shift+P / Cmd+Shift+P) and type β€œDjango ORM Lens”:

Command What it does
Django ORM Lens: Refresh Force-rescan the workspace
Django ORM Lens: Show ER Diagram Open the Mermaid ER diagram side-by-side
Django ORM Lens: Filter Models Filter the tree by app / model / field name
Django ORM Lens: Clear Filter Restore the full tree
Django ORM Lens: Jump to Model Programmatic β€” triggered by tree clicks and hover cards


πŸ—ΊοΈ Roadmap

Shipped

Next

Later

Vote by πŸ‘-ing the corresponding issue.


❓ FAQ

Do you send any of my code to a server?
No. Every byte stays on your machine. The parser is pure TypeScript (extension) or pure Python (CLI). No LLM calls, no telemetry, no analytics, no error reporting. The Mermaid renderer runs inside VS Code's webview sandbox.
Does it work with Poetry / uv / conda / no venv at all?
Yes. The extension reads Python source directly β€” it does not import Django and does not care what package manager you use. The CLI requires Python 3.9+, but that is it.
My models are split across multiple files inside a models/ package. Does that work?
Yes, since v0.2.0. Both the extension and the CLI walk models/*.py alongside classic models.py.
Can I use it with DRF serializers, Wagtail, Oscar, or third-party base models?
Any class that looks like a Django model is picked up: subclasses of models.Model, abstract bases starting with Abstract, common mixins ending in Mixin, and known base names like TimeStampedModel or PolymorphicModel. Non-model classes (ModelAdmin, ModelSerializer, Form, View, Manager, …) are filtered out.
Which AI agents can use the MCP server?
Any MCP-compatible client β€” Cursor, Aider, Continue.dev, Zed, and any other tool that speaks the protocol. Just point command at the installed django-orm-lens-mcp binary. See the Integrations section.
Is there a JetBrains / PyCharm version?
Not yet. PyCharm's Django Structure tool window is already good, so the value delta is smaller. If enough people ask, it becomes worth doing.


πŸ†˜ Support


✨ Contributors

Thanks to these wonderful people (emoji key) β€” all contribution types count, not just code. Translations, docs, screenshots, bug reports, and answered questions are all first-class.

New here? See CONTRIBUTING.md β†’ β€œHow to become a contributor” and browse good first issue.

frowningdev
frowningdev

πŸ’» πŸ“– 🎨 πŸ€” 🚧 πŸ‘€ ⚠️ πŸš‡
Bao
Bao

πŸ’» ⚠️

This project follows the all-contributors specification. To be added, comment @all-contributors please add @your-username for docs (or code, translation, design, ideas, question, bug, test, tutorial, example, …) on any issue or PR.


πŸ“œ License

MIT Β© FROWNINGdev


**Made for developers who care about their codebase.** [Marketplace](https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens) Β· [PyPI](https://pypi.org/project/django-orm-lens/) Β· [GitHub](https://github.com/FROWNINGdev/django-orm-lens) Β· [Issues](https://github.com/FROWNINGdev/django-orm-lens/issues) Β· [Discussions](https://github.com/FROWNINGdev/django-orm-lens/discussions) Β· [Sponsor](https://github.com/sponsors/FROWNINGdev)