Skip to content

Commit

Permalink
fix(django): contrib.auth.models.User.objects, Manager -> UserManager (
Browse files Browse the repository at this point in the history
…sbdchd#42)

UserManager has a couple more methods
  • Loading branch information
sbdchd authored Jul 16, 2021
1 parent c41eca0 commit ac276cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tests/trout/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from uuid import UUID

import psycopg2
from django.contrib.auth.models import User as AuthUser
from django.contrib.postgres.fields import (
ArrayField,
CICharField,
Expand Down Expand Up @@ -915,3 +916,6 @@ class HandField(models.Field[Any, Any]):
def __init__(self, *args: Any, **kwargs: Any) -> None:
kwargs["max_length"] = 104
super().__init__(*args, **kwargs) # type: ignore [call-arg]


AuthUser.objects.create_superuser(username="foo", email=None, password=None)
4 changes: 2 additions & 2 deletions typings/django/contrib/auth/models.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from django.contrib.auth.validators import UnicodeUsernameValidator
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models.base import Model
from django.db.models.manager import EmptyManager, Manager
from django.db.models.manager import EmptyManager

if sys.version_info < (3, 8):
from typing_extensions import Literal
Expand Down Expand Up @@ -104,7 +104,7 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin):
) -> None: ...

class User(AbstractUser):
objects: Manager[User]
objects: UserManager[User]

class AnonymousUser:
id: Any = ...
Expand Down

0 comments on commit ac276cc

Please sign in to comment.