-
-
Notifications
You must be signed in to change notification settings - Fork 485
make BaseModelAdmin generic to properly type methods dealing with models #504
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
Conversation
…delAdmin.delete_model closes #482
black failed in ci, but when i ran it locally it wanted to make a lot of completely unrelated changes, which i figured wouldn't really be good for this pr |
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! 👍
Please, reformat this file only, I think that it is ok to trust black to do its job.
Maybe it has a new version / rule to apply.
i added a new typevar |
obj
argument of ModelAdmin.delete_modelThere 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.
Awesome work! 👍
Let's add a single test case for ModelAdmin
class! Currently, we are terrible at test-coverage 😞
You can take some inspiration from https://github.com/typeddjango/django-stubs/blob/master/test-data/typecheck/contrib/admin/test_options.yml
i'd love to add a test case, but i'm not quite clear on what i would test. just write subclass of |
I was thinking about revealing type of https://github.com/typeddjango/django-stubs/pull/504/files#diff-8143d231653e2933a801943d02bd50968776e6f1805a191aad7012d4881b129cR162 |
would something like this work? reveal_type worked, but the output looked really unintuitive, so i figured it might be best to just have the field typecheck if that's good with you, i'll add something that doesn't typecheck to make sure the constraint works properly |
Thanks a lot! |
Feel free to send a new PR with an extra test 👍 |
i have made things!
related issues
closes #482
this is my first time really working with mypy like this, apologies if i made any mistakes that i didn't catch