Skip to content

Commit

Permalink
Remove the JoinManager class
Browse files Browse the repository at this point in the history
It doesn't add anything that an autogenerated manager cannot provide.
  • Loading branch information
mthuurne committed Apr 16, 2024
1 parent a86c14e commit 60b4861
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
15 changes: 0 additions & 15 deletions model_utils/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,18 +382,3 @@ class Meta:
)
new_qs.query.join(conn, reuse=None)
return new_qs


class JoinManagerMixin:
"""
Manager that adds a method join. This method allows you to join two
querysets together.
"""
_queryset_class = JoinQueryset

def get_queryset(self):
return self._queryset_class(model=self.model, using=self._db)


class JoinManager(JoinManagerMixin, models.Manager):
pass
6 changes: 3 additions & 3 deletions tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from model_utils import Choices
from model_utils.fields import MonitorField, SplitField, StatusField, UUIDField
from model_utils.managers import InheritanceManager, JoinManager, QueryManager
from model_utils.managers import InheritanceManager, JoinQueryset, QueryManager
from model_utils.models import (
SoftDeletableModel,
StatusModel,
Expand Down Expand Up @@ -394,7 +394,7 @@ class ModelWithCustomDescriptor(models.Model):

class BoxJoinModel(models.Model):
name = models.CharField(max_length=32)
objects: ClassVar[JoinManager[BoxJoinModel]] = JoinManager()
objects = JoinQueryset.as_manager()


class JoinItemForeignKey(models.Model):
Expand All @@ -404,7 +404,7 @@ class JoinItemForeignKey(models.Model):
null=True,
on_delete=models.CASCADE
)
objects: ClassVar[JoinManager[JoinItemForeignKey]] = JoinManager()
objects = JoinQueryset.as_manager()


class CustomUUIDModel(UUIDModel):
Expand Down

0 comments on commit 60b4861

Please sign in to comment.