+
+
+@ssi_included
+def tag_box(request, pk):
+ tag = get_object_or_404(models.Tag, pk=pk)
+ assert tag.category != 'set'
+
+ return render(request, 'catalogue/tag_box.html', {
+ 'tag': tag,
+ })
+
+
+@ssi_included
+def collection_box(request, pk):
+ obj = get_object_or_404(models.Collection, pk=pk)
+
+ return render(request, 'catalogue/collection_box.html', {
+ 'obj': obj,
+ })
+
+
+def tag_catalogue(request, category):
+ if category == 'theme':
+ tags = models.Tag.objects.usage_for_model(
+ models.Fragment, counts=True).filter(category='theme')
+ else:
+ tags = list(get_top_level_related_tags((), categories=(category,)))
+
+ if len(tags) > 3:
+ best = random.sample(tags, 3)
+ else:
+ best = tags
+
+ return render(request, 'catalogue/tag_catalogue.html', {
+ 'tags': tags,
+ 'best': best,
+ 'title': constants.CATEGORIES_NAME_PLURAL[category],
+ })
+
+
+def collections(request):
+ objects = models.Collection.objects.all()
+
+ if len(objects) > 3:
+ best = random.sample(objects, 3)
+ else:
+ best = objects
+
+ return render(request, 'catalogue/collections.html', {
+ 'objects': objects,
+ 'best': best,
+ })