-
Notifications
You must be signed in to change notification settings - Fork 63
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
Beginner questions #186
Comments
Hmm good question, I'm not super familiar with using Pyright for type checking, I usually use it for autocomplete and run mypy in CI, but:
Like: class study(models.Model):
LEVEL_CHOICES = (
("e", _("Elementary"),
("h", _("HighSchool")
)
level = models.CharField(
max_length=1
choices= LEVEL_CHOICES,
blank= True)
if TYPING:
def get_level_display(self) -> SomeTypeHereIDK: ...
def info(self):
return "%s" % self.get_level_display() # ReportUnkownMemberType and ReportGeneralTypeIssues tricky part of Django ORM are these generated / metaprogrammed/ monkey patched things that can't be expressed statically |
Appreciate the response. After trying django-types and pyright on a branch, I decided against going further with it. The application I'm working on relies on the meta programmed parts. I don't see django-types helping me. Instead I have to sprinkle the models everywhere with backlinks, autogenerated functions, 'id' and more. Especially since django-stubs knows how to do it. |
Started using Pyright and VScode. Used mypy a lot, but since typing support in VSCode is done via pyright, here I am.
Is there a recommend pyright config?
On my Django models I have a
class Meta
defined and there's an error that:"Meta" overrides symbol of same name in class "Model"...
reportIncompatibleVariableOverride
Didn't see it mentioned in the documentation. Is there a recommended way to handle this?
I have multiple choices.
Example:
What's the recommended solution?
The text was updated successfully, but these errors were encountered: