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

Manager.acreate: model isn't type checked #2090

Open
jlost opened this issue Apr 28, 2024 · 0 comments
Open

Manager.acreate: model isn't type checked #2090

jlost opened this issue Apr 28, 2024 · 0 comments

Comments

@jlost
Copy link
Contributor

jlost commented Apr 28, 2024

from django.db import models

class Thing(models.Model):
    id = models.AutoField()

def create_thing_sync(name: str) -> None:
    Thing.objects.create(name="This line shows an error")

async def create_thing_async(name: str) -> None:
    Thing.objects.acreate(name="This one doesn't")

Error only appears for the first example, but it should show for both:

mypy thing.py
Unexpected attribute "name" for model "Thing"

I think the problem is in the mypy plugin. I'll take a look when I get the chance.

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

No branches or pull requests

1 participant