Thanks, I've added a function to the Enty models. It doesn't in some cases I get good returns now. But not always.
Content is the name of the app. There is no PK-relation on the Category class, but only the below on the Entry class. class Entry(models.Model): categories = models.ManyToManyField(Category, blank=True, null=True, default = None) def related_entries(self): related = Entry._default_manager.get(categories=self.categories.all()) return related {% for related_entry in object.related_entries %} <p><a href="{{ related_entry.get_absolute_url }}">{{ related_entry.title }}</a></p> {% endfor %} The related_entries work when all categories match. If there is a difference (e.g. an Entry has multiple categories) it should return none. Instead I get an error statement, which is probably because for each assigned category to the entry a row is returned. Caught DatabaseError while rendering: more than one row returned by a subquery used as an expression -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/o8nDUPhukuwJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.