simplify SearchEntry instantiation
[mygpo.git] / mygpo / search / util.py
blob1e5c9e13126c61ae700bc4ca209cfb3c66e7b148
1 from django.db.models import Count
2 from mygpo.api.models import Subscription, Podcast
3 from mygpo.data.models import PodcastTag
5 def tag_string(tags, max_length=200):
6 """
7 returns a string of the most-assigned tags
9 tags is expected to be a PodcastTag QuerySet
10 """
11 tags = PodcastTag.objects.top_tags(tags)
12 return ','.join([t['tag'] for t in tags])[:max_length]