[Fixed]-Django Queryset of related objects, after prefiltering on original model

27👍

The trick for this is to remember that if you want a queryset of Blogs, you should start with the Blog model. Then, you can use the double-underscore syntax to follow relations. So:

author_blogs = Blog.objects.filter(entry__authors=author)

Leave a comment