Skip to content
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

Support QuerySet with Generic types #7

Open
w0rp opened this issue Jun 8, 2017 · 0 comments
Open

Support QuerySet with Generic types #7

w0rp opened this issue Jun 8, 2017 · 0 comments

Comments

@w0rp
Copy link

w0rp commented Jun 8, 2017

I have some modified stubs for QuerySet and Manager so they accept type parameters. This makes the following possible.

for foo in Foo.objects.all(): # The type of foo is inferred as Foo

Using it requires stubbing models like so.

# foo.py
from django.db import models


class Foo(models.Model):
    bar = models.CharField(max_length=255)
# foo.pyi
from django.db import models


class Foo(models.Model):
    objects = ... # type: models.Manager['Foo']
    bar = ... # type: str

Would you be interested in adding this to the project if I create a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant