+ @classmethod
+ def search(cls, query, qs=None):
+ Tag = apps.get_model('catalogue', 'Tag')
+ if qs is None:
+ qs = cls.objects.all()
+ pd_authors = qs.annotate(search_vector=UnaccentSearchVector('name')).filter(search_vector=query)
+ existing_slugs = Tag.objects.filter(
+ category='author', slug__in=list(pd_authors.values_list('slug', flat=True))) \
+ .values_list('slug', flat=True)
+ pd_authors = pd_authors.exclude(slug__in=existing_slugs)
+ return pd_authors
+