if request.user.is_authenticated():
extra_where = '(NOT catalogue_tag.category = "set" OR catalogue_tag.user_id = %d)' % request.user.id
else:
extra_where = 'NOT catalogue_tag.category = "set"'
related_tags = models.Tag.objects.related_for_model(tags, models.Book, counts=True, extra={'where': [extra_where]})
categories = split_tags(related_tags)
if request.user.is_authenticated():
extra_where = '(NOT catalogue_tag.category = "set" OR catalogue_tag.user_id = %d)' % request.user.id
else:
extra_where = 'NOT catalogue_tag.category = "set"'
related_tags = models.Tag.objects.related_for_model(tags, models.Book, counts=True, extra={'where': [extra_where]})
categories = split_tags(related_tags)