1# First, define the Manager subclass.
2class DahlBookManager(models.Manager):
3 def get_queryset(self):
4 return super().get_queryset().filter(author='Roald Dahl')
5
6# Then hook it into the Book model explicitly.
7class Book(models.Model):
8 title = models.CharField(max_length=100)
9 author = models.CharField(max_length=50)
10
11 objects = models.Manager() # The default manager.
12 dahl_objects = DahlBookManager() # The Dahl-specific manager.
13