Yes, you would just use self.filter, where 'self' refers to the Manager itself. The default Manager for the model is objects
, and it is automatically created if you don't specify a custom manager. Because you a doing a custom manager, you don't use objects
, because obviously that would use the default one, and not your custom one.
So, from the Docs, an example would be:
class BookManager(models.Manager):
def title_count(self, keyword):
return self.filter(title__icontains=keyword).count()
class Book(models.Model):
title = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)
publication_date = models.DateField()
num_pages = models.IntegerField(blank=True, null=True)
objects = BookManager()