Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Django Model LensNew to Visual Studio Code? Get it now.
Django Model Lens

Django Model Lens

Arjun Thakor

|
4 installs
| (0) | Free
Inline intelligence for Django projects — reference counts, URL route mapping, model anchor badges, and CBV attribute gutter icons.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Django Model Lens

A VS Code extension that brings inline intelligence to Django projects — reference counts, URL route mapping, and model/method visual anchors, all without leaving your editor.

Django Model Lens — models.py with gutter icons and reference counts

Features

Reference Counts

CodeLens reference counts above class and def declarations

  • Shows N references as a CodeLens above every class and def declaration in Python files
  • Click the lens to open a custom references panel

Custom references panel with file path, line number, and code preview

  • Each row shows the file path, line number, and a code preview — click to jump directly to that location
  • Works without Pylance — falls back to a built-in workspace-wide grep scanner when no language server is active
  • Automatically refreshes when files are saved or deleted

Reverse URL Routing Mapper

Displays the mapped URL pattern(s) directly above each Django view, so you never have to switch to urls.py to look up a route.

  • Function-based views — shows the registered URL and HTTP methods detected from @api_view
  • Class-based views — shows the URL and HTTP methods defined on the class (get, post, delete, …)
  • DRF ViewSets — shows per-action lenses (list, create, retrieve, update, partial_update, destroy) with the correct list or detail URL derived automatically
  • Click any lens to jump to the matching path() or router.register() call in urls.py
  • Supports path(), re_path(), and DRF DefaultRouter / SimpleRouter

views.py with URL Routing Mapper CodeLens


Model Anchor Badges (models.py)

Adds gutter icons and CodeLens badges in models.py to make the file easier to scan at a glance.

Icon Appears on Meaning
Model class icon Every class Foo(Model): line Marks a Django model class
Function icon Every def inside a model Marks a model method or manager
  • $(database) Model · ClassName CodeLens badge above each model class — a non-clickable visual anchor that keeps model names visible without scrolling
  • Field reference counts — shows N references above every models.Field(…) assignment (e.g. username = models.CharField(...)) so you can see where each field is used across the project
  • Method reference counts — shows N references above every method defined inside a model class; click to open the references panel

CBV Attribute Gutter Icons (views.py)

Adds colored gutter icons next to class-based view attributes in views.py for quick visual scanning.

Icon Attribute Meaning
Model icon model = … The Django model this view reads from or writes to
Template icon template_name = … The HTML template rendered by this view
Context icon context_object_name = … The variable name used to access the object in the template

views.py with CBV attribute gutter icons


Requirements

  • VS Code 1.118.0 or later
  • A Django project with urls.py and views.py / models.py files

Release Notes

0.0.5

  • Added CBV attribute gutter icons in views.py — blue database icon for model =, code icon for template_name =, and brackets icon for context_object_name =
  • Extracted SVG icon colors into named constants for easy theming

0.0.4

  • Added field-level reference count CodeLens for models.Field(…) assignments in models.py
  • Model method (def) reference counts now appear inline within model class bodies

0.0.3

  • Added Reverse URL Routing Mapper — per-view and per-method/action CodeLens linked to urls.py
  • Added Model Anchor Badges — gutter SVG icons and CodeLens badges in models.py

0.0.2

Added extension icon and Marketplace screenshots.

0.0.1

Initial release.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft