- if filter:
- pictures = pictures.filter(filter)
- if get_filter:
- pictures = pictures.filter(get_filter())
- return render(request, template_name, {'picture_list': list(pictures)})
+
+ related_tags = Tag.objects.usage_for_model(Picture, counts=True)
+ related_tags = sorted(related_tags, key=lambda t: -t.count)
+ suggestion_categories = Counter()
+ suggestions = []
+ for t in related_tags:
+ if suggestion_categories[t.category] < 3:
+ suggestion_categories[t.category] += 1
+ suggestions.append(t)
+ if sum(suggestion_categories.values()) == 10:
+ break
+ template_name = 'catalogue/2022/author_detail.html'
+ return render(request, template_name, {
+ 'object_list': pictures,
+ 'title': 'Galeria',
+ 'tags': [],
+ 'suggest': suggestions,
+ 'list_type': 'gallery',
+ })