django-orm-lens 1.0.0__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/PKG-INFO +3 -1
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/README.md +2 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens/__init__.py +1 -1
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens/models.py +6 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens/parser.py +16 -1
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens.egg-info/PKG-INFO +3 -1
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/pyproject.toml +1 -1
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens/cli.py +0 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens/formatters.py +0 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens/mcp_server.py +0 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens/py.typed +0 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens.egg-info/SOURCES.txt +0 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens.egg-info/dependency_links.txt +0 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens.egg-info/entry_points.txt +0 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens.egg-info/requires.txt +0 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens.egg-info/top_level.txt +0 -0
- {django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-orm-lens
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Static analysis + MCP server for Django models. Sidebar tree, ER diagrams, and JSON output for terminals and AI coding agents.
|
|
5
5
|
Author: frowningdev
|
|
6
6
|
License: MIT
|
|
@@ -46,6 +46,8 @@ Requires-Dist: twine>=5.1; extra == "dev"
|
|
|
46
46
|
|
|
47
47
|
# django-orm-lens
|
|
48
48
|
|
|
49
|
+
<!-- mcp-name: io.github.frowningdev/django-orm-lens -->
|
|
50
|
+
|
|
49
51
|
**Static analysis + MCP server for Django models.** Terminal- and AI-agent-friendly.
|
|
50
52
|
|
|
51
53
|
Ships with a zero-dependency parser, a JSON/Markdown/table CLI, and an optional
|
|
@@ -4,7 +4,7 @@ Terminal / editor-agnostic parser for Django models.py files.
|
|
|
4
4
|
Ships a CLI and an optional MCP server for AI coding agents.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
__version__ = "1.0.
|
|
7
|
+
__version__ = "1.0.2"
|
|
8
8
|
|
|
9
9
|
from .models import ParsedApp, ParsedField, ParsedModel, WorkspaceIndex
|
|
10
10
|
from .parser import parse_models_file, scan_workspace
|
|
@@ -21,6 +21,8 @@ class ParsedField:
|
|
|
21
21
|
line_number: int
|
|
22
22
|
related_model: Optional[str] = None
|
|
23
23
|
relation_kind: Optional[RelationKind] = None
|
|
24
|
+
on_delete: Optional[str] = None
|
|
25
|
+
related_name: Optional[str] = None
|
|
24
26
|
|
|
25
27
|
def to_dict(self) -> dict:
|
|
26
28
|
out = {
|
|
@@ -34,6 +36,10 @@ class ParsedField:
|
|
|
34
36
|
out["relatedModel"] = self.related_model
|
|
35
37
|
if self.relation_kind is not None:
|
|
36
38
|
out["relationKind"] = self.relation_kind
|
|
39
|
+
if self.on_delete is not None:
|
|
40
|
+
out["onDelete"] = self.on_delete
|
|
41
|
+
if self.related_name is not None:
|
|
42
|
+
out["relatedName"] = self.related_name
|
|
37
43
|
return out
|
|
38
44
|
|
|
39
45
|
|
|
@@ -123,6 +123,18 @@ def _extract_related(args_block: str):
|
|
|
123
123
|
return raw.strip("'\"")
|
|
124
124
|
|
|
125
125
|
|
|
126
|
+
def _extract_on_delete(args_block: str):
|
|
127
|
+
m = re.search(r"on_delete\s*=\s*(?:models\.)?([A-Z][A-Z_]+)", args_block)
|
|
128
|
+
return m.group(1) if m else None
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _extract_related_name(args_block: str):
|
|
132
|
+
m = re.search(r"related_name\s*=\s*(?:'([^']+)'|\"([^\"]+)\")", args_block)
|
|
133
|
+
if not m:
|
|
134
|
+
return None
|
|
135
|
+
return m.group(1) or m.group(2)
|
|
136
|
+
|
|
137
|
+
|
|
126
138
|
def _read_balanced_args(lines: Sequence[str], start: int):
|
|
127
139
|
open_idx = lines[start].index("(")
|
|
128
140
|
depth = 0
|
|
@@ -242,7 +254,10 @@ def parse_models_file(file_path: str, content: str) -> List[ParsedModel]:
|
|
|
242
254
|
)
|
|
243
255
|
if is_rel:
|
|
244
256
|
field.relation_kind = ftype # type: ignore[assignment]
|
|
245
|
-
|
|
257
|
+
inner = args_block.rstrip(")")
|
|
258
|
+
field.related_model = _extract_related(inner)
|
|
259
|
+
field.on_delete = _extract_on_delete(inner)
|
|
260
|
+
field.related_name = _extract_related_name(inner)
|
|
246
261
|
model.fields.append(field)
|
|
247
262
|
j = end_idx + 1
|
|
248
263
|
continue
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-orm-lens
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Static analysis + MCP server for Django models. Sidebar tree, ER diagrams, and JSON output for terminals and AI coding agents.
|
|
5
5
|
Author: frowningdev
|
|
6
6
|
License: MIT
|
|
@@ -46,6 +46,8 @@ Requires-Dist: twine>=5.1; extra == "dev"
|
|
|
46
46
|
|
|
47
47
|
# django-orm-lens
|
|
48
48
|
|
|
49
|
+
<!-- mcp-name: io.github.frowningdev/django-orm-lens -->
|
|
50
|
+
|
|
49
51
|
**Static analysis + MCP server for Django models.** Terminal- and AI-agent-friendly.
|
|
50
52
|
|
|
51
53
|
Ships with a zero-dependency parser, a JSON/Markdown/table CLI, and an optional
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "django-orm-lens"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.2"
|
|
8
8
|
description = "Static analysis + MCP server for Django models. Sidebar tree, ER diagrams, and JSON output for terminals and AI coding agents."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_orm_lens-1.0.0 → django_orm_lens-1.0.2}/django_orm_lens.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|