diff --git a/docs/managers.rst b/docs/managers.rst index d5b5fb0..43aa030 100644 --- a/docs/managers.rst +++ b/docs/managers.rst @@ -117,15 +117,6 @@ set the ordering of the ``QuerySet`` returned by the ``QueryManager`` by chaining a call to ``.order_by()`` on the ``QueryManager`` (this is not required). - -PassThroughManager ------------------- - -`PassThroughManager` was removed in django-model-utils 2.4. Use Django's -built-in `QuerySet.as_manager()` and/or `Manager.from_queryset()` utilities -instead. - - SoftDeletableManager -------------------- @@ -137,45 +128,8 @@ Mixins ------ Each of the above manager classes has a corresponding mixin that can be used to -add functionality to any manager. For example, to create a GeoDjango -``GeoManager`` that includes "pass through" functionality, you can write the -following code: +add functionality to any manager. -.. code-block:: python - - from django.contrib.gis.db import models - from django.contrib.gis.db.models.query import GeoQuerySet - - from model_utils.managers import PassThroughManagerMixin - - class PassThroughGeoManager(PassThroughManagerMixin, models.GeoManager): - pass - - class LocationQuerySet(GeoQuerySet): - def within_boundary(self, geom): - return self.filter(point__within=geom) - - def public(self): - return self.filter(public=True) - - class Location(models.Model): - point = models.PointField() - public = models.BooleanField(default=True) - objects = PassThroughGeoManager.for_queryset_class(LocationQuerySet)() - - Location.objects.public() - Location.objects.within_boundary(geom=geom) - Location.objects.within_boundary(geom=geom).public() - - -Now you have a "pass through manager" that can also take advantage of -GeoDjango's spatial lookups. You can similarly add additional functionality to -any manager by composing that manager with ``InheritanceManagerMixin`` or -``QueryManagerMixin``. - -(Note that any manager class using ``InheritanceManagerMixin`` must return a +Note that any manager class using ``InheritanceManagerMixin`` must return a ``QuerySet`` class using ``InheritanceQuerySetMixin`` from its ``get_queryset`` -method. This means that if composing ``InheritanceManagerMixin`` and -``PassThroughManagerMixin``, the ``QuerySet`` class passed to -``PassThroughManager.for_queryset_class`` must inherit -``InheritanceQuerySetMixin``.) +method.