Skip to content

Installed stubs don't take precedence over bundled stubs #5031

@rchiodo

Description

@rchiodo

See this issue #5027

  1. Install django-stubs into your environment
  2. Set typechecking mode to basic
  3. Add the following code to a file
from django.db import models

class MyModel(models.Model):
    nullable = models.IntegerField(null=True)

def foo():
    m = MyModel.objects.get()

    def accepts_only_int(x: int):
        pass

    accepts_only_int(m.nullable)
  1. If we actually used the django-stubs, passing m.nullable to accepts_only_int shouldn't show an error.
  2. If you goto declaration on models.IntegerField it will still jump into our bundled stubs.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdjangoRelated to django support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions