dedicated support for Django
### Summary This is an expansion on the known issue: No implicit import of submodules (https://github.com/astral-sh/ty/issues/133). I've imported Django models explicitly from their submodules. There is an issue with dynamic model attributes like objects and id that Ty doesn’t recognize. I’m encountering persistent unresolved-attribute errors when running Ty static type checker on Django models, specifically on standard Django model attributes such as id, demo_name, and objects. These errors occur even though the Django model is properly defined, registered, explicitly imported and confirmed to have those attributes in the Django shell. Steps to reproduce: Define a Django model with fields such as id, demo_name in apps/sample/models/example.py. Confirm the model loads and works correctly inside the Django shell: ```py from apps.sample.models.example import Demo from django.db import models issubclass(Demo, models.Model) # Returns True Demo._meta.get_fields() # Returns expected model fields including 'id' Demo.objects.all() # Executes without error ``` Run Ty on a test file that uses this model, e.g. test_ty_model.py: ```py def test_model_fields(m: Demo): reveal_type(m.id) reveal_type(m.demo_name) reveal_type(m.save) ``` Ty reports errors like: ``` error[unresolved-attribute]: Type `Demo` has no attribute `id` error[unresolved-attribute]: Type `Demo` has no attribute `objects` ``` I have tried running Ty with explicit environment variables to load D
Posted by aaschenbrener on Aug 16, 2025, 4:16 AM
Tags
Related issues
- Add 65536 size support for maps
- TypeScript 7.1 Iteration Plan
- nvim-treeconfig: upstream nvim-treesitter
- Add the "action" and "method" attributes to <button>
- [FEATURE] Support multiple Connector accounts (same connector, different accounts) in Claude and Claude Code on the web (claude.ai/code)
- > We were imposed GitHub for so many exercises!
Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments
support (Software)
Add 65536 size support for maps
TypeScript 7.1 Iteration Plan
nvim-treeconfig: upstream nvim-treesitter
Add the "action" and "method" attributes to <button>
[FEATURE] Support multiple Connector accounts (same connector, different accounts) in Claude and Claude Code on the web (claude.ai/code)
> We were imposed GitHub for so many exercises!
Add support for Visual Studio 2026 Integration
Support for Helm v4
dedicated support for Django
### Summary This is an expansion on the known issue: No implicit import of submodules (https://github.com/astral-sh/ty/issues/133). I've imported Django models explicitly from their submodules. There is an issue with dynamic model attributes like objects and id that Ty doesn’t recognize. I’m encountering persistent unresolved-attribute errors when running Ty static type checker on Django models, specifically on standard Django model attributes such as id, demo_name, and objects. These errors occur even though the Django model is properly defined, registered, explicitly imported and confirmed to have those attributes in the Django shell. Steps to reproduce: Define a Django model with fields such as id, demo_name in apps/sample/models/example.py. Confirm the model loads and works correctly inside the Django shell: ```py from apps.sample.models.example import Demo from django.db import models issubclass(Demo, models.Model) # Returns True Demo._meta.get_fields() # Returns expected model fields including 'id' Demo.objects.all() # Executes without error ``` Run Ty on a test file that uses this model, e.g. test_ty_model.py: ```py def test_model_fields(m: Demo): reveal_type(m.id) reveal_type(m.demo_name) reveal_type(m.save) ``` Ty reports errors like: ``` error[unresolved-attribute]: Type `Demo` has no attribute `id` error[unresolved-attribute]: Type `Demo` has no attribute `objects` ``` I have tried running Ty with explicit environment variables to load D
Comments (0)
No comments yet. Start the discussion.