Top 7 most common tags Taggit
<pre><code>def most_common(self):
    return self.get_queryset().annotate(
        num_times=models.Count(self.through.tag_relname())
        ).order_by('-num_times')
</code></pre>

<p>How would I edit this to only view the top 7 tags. This is a function from taggit and I would only like to see only 7. thanks. </p>

<p>How about most_common()[:7]? docs.djangoproject.com/en/1.10/topics/db/queries/â¦ â ozgur</p>

<p>This is the correct asnwer, thanks ozgur</p>

python django django-views