+def collection(request, slug):
+ coll = get_object_or_404(models.Collection, slug=slug)
+ slugs = coll.book_slugs.split()
+ # allow URIs
+ slugs = [slug.rstrip('/').rsplit('/', 1)[-1] if '/' in slug else slug
+ for slug in slugs]
+ return book_list(request, Q(slug__in=slugs),
+ template_name='catalogue/collection.html',
+ context={'collection': coll})
+
+