Skip to content

get_object_or_404 has type Model instead of Team #22

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

Closed
chdsbd opened this issue Feb 12, 2019 · 0 comments
Closed

get_object_or_404 has type Model instead of Team #22

chdsbd opened this issue Feb 12, 2019 · 0 comments

Comments

@chdsbd
Copy link

chdsbd commented Feb 12, 2019

get_object_or_404 is returning type Model when I would expect it to return type Team.

Here's the example:

from django.shortcuts import get_object_or_404

from django.db import models

class Team(models.Model):
    name = models.CharField(max_length=255)
    is_public = models.BooleanField(default=False)


team: Team = get_object_or_404(Team, pk=5)
# example.py:12:1: error: Incompatible types in assignment (expression has type "Model", variable has type "Team")
mypy = "^0.670
mypy_extensions = "^0.4.1"
django-stubs = "^0.3.0"
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