Skip to content

Commit

Permalink
[3.0.x] Fixed #27865 -- Adjusted docs example to avoid confusion with…
Browse files Browse the repository at this point in the history
… models.BaseManager.

Backport of a2f5542 from master
  • Loading branch information
radwon authored and carltongibson committed Mar 10, 2020
1 parent 0fde266 commit 0f524f5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/topics/db/managers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ For advanced usage you might want both a custom ``Manager`` and a custom
returns a *subclass* of your base ``Manager`` with a copy of the custom
``QuerySet`` methods::

class BaseManager(models.Manager):
class CustomManager(models.Manager):
def manager_only_method(self):
return

Expand All @@ -339,14 +339,14 @@ returns a *subclass* of your base ``Manager`` with a copy of the custom
return

class MyModel(models.Model):
objects = BaseManager.from_queryset(CustomQuerySet)()
objects = CustomManager.from_queryset(CustomQuerySet)()

You may also store the generated class into a variable::

CustomManager = BaseManager.from_queryset(CustomQuerySet)
MyManager = CustomManager.from_queryset(CustomQuerySet)

class MyModel(models.Model):
objects = CustomManager()
objects = MyManager()

.. _custom-managers-and-inheritance:

Expand Down

0 comments on commit 0f524f5

Please sign in to comment.