[Answer]-Set_all to get value from custom model manager in django

1👍

Well I guess you can do something like

class TutuorialManager(models.Manager):
    def published(self):
        return self.filter(is_published = True)

then in the views you can do something like..

{% for category in categories %}
    {% for tutorial in category.tutorial_set.published.all %}
       {{ tutorial.title }}
    {% endfor %}
{% endfor %}

Leave a comment