[Fixed]-I can't access QuerySet in Manager's init method in Django

1👍

You’re calling the parent’s get_query() method. You’re not overriding it so there’s no point, just call it on self. Better yet, make this operation lazy. Properties are an option:

class ArticleManager(models.Manager):
    @property
    def article_paginator(self):
        return Paginator(self.get_queryset(), 10)

Then you can access it via Article.objects.article_paginator.

Leave a comment