Context
django-taggit is one of the most widely used Django packages, and it is listed in awesome-django's Models section. A model using it looks like this:
class Post(models.Model):
title = models.CharField(max_length=200)
tags = TaggableManager() # ← currently invisible
TaggableManager is not in the BARE_FIELD_TYPES whitelist (cli/django_orm_lens/parser.py:59), so tags is dropped: it never appears in the sidebar, the ER diagram, or describe output. Semantically it is a many-to-many to taggit.Tag through taggit.TaggedItem, so the information is genuinely useful to show.
What to change
In cli/django_orm_lens/parser.py:
- Add
TaggableManager to BARE_FIELD_TYPES (line 59).
- Decide how it should surface as a relation. The natural mapping is an M2M whose target is
taggit.Tag and whose through is taggit.TaggedItem — _extract_through_model (line 278) already exists for the explicit through= case, so the work is supplying those defaults when the field type is TaggableManager rather than reading them from the call arguments.
TaggableManager(through=CustomTaggedItem) is a real pattern — an explicit through= must win over the default.
Because taggit.Tag normally lives outside the scanned workspace, check how out-of-workspace targets are already handled: test_out_of_workspace_targets_skipped (cli/tests/test_er_formats.py:149) pins that behaviour, and whatever you do here must not break it. Deciding whether the tag target is drawn as an external node or omitted from the diagram is the main design question — say what you picked in the PR and we can discuss it there.
No taggit import and no new dependency: the parser is pure-static by design and has to work against a project with no venv at all.
Acceptance criteria
tags = TaggableManager() appears as an M2M field in scan / describe.
- An explicit
through= argument overrides the default.
- Tests alongside the existing parser tests, plus an ER assertion consistent with the out-of-workspace rule above.
Getting started
pip install -e "cli[dev]"
pytest cli/tests -v -k parser
This is one half of the "third-party field support" roadmap item; django-mptt is #49.
Context
django-taggit is one of the most widely used Django packages, and it is listed in
awesome-django's Models section. A model using it looks like this:TaggableManageris not in theBARE_FIELD_TYPESwhitelist (cli/django_orm_lens/parser.py:59), sotagsis dropped: it never appears in the sidebar, the ER diagram, ordescribeoutput. Semantically it is a many-to-many totaggit.Tagthroughtaggit.TaggedItem, so the information is genuinely useful to show.What to change
In
cli/django_orm_lens/parser.py:TaggableManagertoBARE_FIELD_TYPES(line 59).taggit.Tagand whosethroughistaggit.TaggedItem—_extract_through_model(line 278) already exists for the explicitthrough=case, so the work is supplying those defaults when the field type isTaggableManagerrather than reading them from the call arguments.TaggableManager(through=CustomTaggedItem)is a real pattern — an explicitthrough=must win over the default.Because
taggit.Tagnormally lives outside the scanned workspace, check how out-of-workspace targets are already handled:test_out_of_workspace_targets_skipped(cli/tests/test_er_formats.py:149) pins that behaviour, and whatever you do here must not break it. Deciding whether the tag target is drawn as an external node or omitted from the diagram is the main design question — say what you picked in the PR and we can discuss it there.No
taggitimport and no new dependency: the parser is pure-static by design and has to work against a project with no venv at all.Acceptance criteria
tags = TaggableManager()appears as an M2M field inscan/describe.through=argument overrides the default.Getting started
pip install -e "cli[dev]" pytest cli/tests -v -k parserThis is one half of the "third-party field support" roadmap item; django-mptt is #49.