-
-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make AddRelatedManagers look for "objects" on parent model #730
Conversation
9c5bb82
to
e28a390
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, let's see what CI will say.
e28a390
to
8c15713
Compare
Looks like CI is broken @sobolevn. |
8c15713
to
5bb5304
Compare
I am also fixing the CI failure in #734 🙂 |
5bb5304
to
e6663a1
Compare
Fails with: ``` pytest_mypy_plugins.utils.TypecheckAssertionError: Invalid output: Expected: main:2: note: Revealed type is "myapp.models.MyUser*" main:3: note: Revealed type is "myapp.models.MyUser*" <45 (diff) <45 (diff) Actual: main:2: note: Revealed type is "myapp.models.MyUser*" main:3: note: Revealed type is "myapp.models.MyUser*" main:6: error: "MyUser" has no attribute "book_set" (diff) main:6: note: Revealed type is "Any" (diff) main:7: error: "MyUser" has no attribute "article_set" (diff) main:7: note: Revealed type is "Any" (diff) ```
Previously, AddRelatedManagers would fail if a related model had inherited its `objects` field from a parent class. This would result in missing relation attributes. This is fixed by using `get()` instead of `names`; the former searches the MRO for the symbol, whereas the latter only looks for symbols declared directly on the class.
e6663a1
to
2f36af8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for working on it! 👍
No problem 🙂 Any idea when the next release is likely to be? |
We need to fix #725 before releasing a new one 😞 |
Previously, AddRelatedManagers would fail if a related model had inherited its
objects
field from a parent class. This would result in missing relation attributes. This is fixed by usingget()
instead ofnames
; the former searches the MRO for the symbol, whereas the latter only looks for symbols declared directly on the class.Related issues
Closes #652