- l_tags = models.Tag.objects.filter(category='book', slug__in=[book.book_tag_slug() for book in books])
+ l_tags = models.Tag.objects.filter(category='book',
+ slug__in=[book.book_tag_slug() for book in books.iterator()])
fragments = models.Fragment.tagged.with_any(l_tags, fragments)
# newtagging goes crazy if we just try:
#related_tags = models.Tag.objects.usage_for_queryset(fragments, counts=True,
# extra={'where': ["catalogue_tag.category != 'book'"]})
fragments = models.Fragment.tagged.with_any(l_tags, fragments)
# newtagging goes crazy if we just try:
#related_tags = models.Tag.objects.usage_for_queryset(fragments, counts=True,
# extra={'where': ["catalogue_tag.category != 'book'"]})
if fragment_keys:
related_tags = models.Fragment.tags.usage(counts=True,
filters={'pk__in': fragment_keys},
if fragment_keys:
related_tags = models.Fragment.tags.usage(counts=True,
filters={'pk__in': fragment_keys},
return render_to_response('catalogue/player.html', locals(),
context_instance=RequestContext(request))
return render_to_response('catalogue/player.html', locals(),
context_instance=RequestContext(request))
- for fragment in book.fragments.all():
- for theme in fragment.tags.filter(category='theme'):
+ for fragment in book.fragments.all().iterator():
+ for theme in fragment.tags.filter(category='theme').iterator():
book_themes.setdefault(theme, []).append(fragment)
book_themes = book_themes.items()
book_themes.setdefault(theme, []).append(fragment)
book_themes = book_themes.items()