Skip to content

Commit

Permalink
Add ManyToManyRelatedManager to auth models (#1)
Browse files Browse the repository at this point in the history
Adds managers for reverse names of many to many relationships in the contrib.auth app.
  • Loading branch information
vforgione authored Apr 19, 2024
1 parent 01e4eb5 commit 0f6a7bd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion django-stubs/contrib/auth/models.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,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
from django.db.models.manager import EmptyManager, ManyToManyRelatedManager

_AnyUser = Model | AnonymousUser

Expand All @@ -34,6 +34,7 @@ class Permission(models.Model):
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
codename = models.CharField(max_length=100)
def natural_key(self) -> tuple[str, str, str]: ...
group_set = ManyToManyRelatedManager["Group", "Permission"]()

_GroupT = TypeVar("_GroupT", bound=Group)

Expand All @@ -46,6 +47,7 @@ class Group(models.Model):
name = models.CharField(max_length=150)
permissions = models.ManyToManyField[Permission, Any](Permission)
def natural_key(self) -> tuple[str, ...]: ...
user_set = ManyToManyRelatedManager["PermissionsMixin", "Group"]()

class UserManager(BaseUserManager[_T]):
def create_user(
Expand Down

0 comments on commit 0f6a7bd

Please sign in to comment.