Django ManyToMany join query
- by Hanpan
I'm sure this is really simple, but I can't for the life of me find any documentation explaining how to do this.
How do I get the results of a ManyToMany field inside a join as opposed to doing this:
{% for tag in article.tags.all %}
Which results in an extra query? What I'd like to do is fetch all related tags when I retrieve the initial article, so I could then do something like:
{% for tag in article.tags %}
Without the .all and the extra query.
Thanks!