class Post(models.Model): ... def list_by_category(self): return Post.objects.filter(category=self.category) ----- template: -----

Related Posts

{% if list_by_category %} {% for post in list_by_category %}

etc... ...end blocks, etc. Does it need to be post.list_by_category?