- # WTF/unused
- @classmethod
- def picture_list(cls, filter=None):
- """Generates a hierarchical listing of all pictures
- Pictures are optionally filtered with a test function.
- """
-
- pics = cls.objects.all().order_by('sort_key').only('title', 'slug', 'image_file')
-
- if filter:
- pics = pics.filter(filter).distinct()
-
- pics_by_author = SortedDict()
- orphans = []
- for tag in catalogue.models.Tag.objects.filter(category='author'):
- pics_by_author[tag] = []
-
- for pic in pics.iterator():
- authors = list(pic.authors().only('pk'))
- if authors:
- for author in authors:
- pics_by_author[author].append(pic)
- else:
- orphans.append(pic)
-
- return pics_by_author, orphans
-