fix in librarian
[wolnelektury.git] / apps / catalogue / views.py
index e5514f0..a25a08f 100644 (file)
@@ -59,7 +59,7 @@ def catalogue(request, as_json=False):
     collections = models.Collection.objects.all()
 
     def render_tag_list(tags):
     collections = models.Collection.objects.all()
 
     def render_tag_list(tags):
-        render_to_string('catalogue/tag_list.html', tag_list(tags))
+        return render_to_string('catalogue/tag_list.html', tag_list(tags))
 
     def render_split(with_books, with_pictures):
         ctx = {}
 
     def render_split(with_books, with_pictures):
         ctx = {}
@@ -212,7 +212,7 @@ def tagged_object_list(request, tags=''):
         all_books = models.Book.tagged.with_all(tags)
         if shelf_is_set:
             books = all_books.order_by('sort_key_author', 'title')
         all_books = models.Book.tagged.with_all(tags)
         if shelf_is_set:
             books = all_books.order_by('sort_key_author', 'title')
-            pictures = Pictures.objects.none()
+            pictures = Picture.objects.none()
             related_book_tags = models.Tag.objects.usage_for_queryset(
                 books, counts=True).exclude(
                 category='set').exclude(pk__in=tags_pks)
             related_book_tags = models.Tag.objects.usage_for_queryset(
                 books, counts=True).exclude(
                 category='set').exclude(pk__in=tags_pks)
@@ -250,7 +250,7 @@ def tagged_object_list(request, tags=''):
             'only_my_shelf': only_my_shelf,
             'formats_form': forms.DownloadFormatsForm(),
             'tags': tags,
             'only_my_shelf': only_my_shelf,
             'formats_form': forms.DownloadFormatsForm(),
             'tags': tags,
-            'tags_ids': tags_pks,
+            'tag_ids': tags_pks,
             'theme_is_set': theme_is_set,
         },
         context_instance=RequestContext(request))
             'theme_is_set': theme_is_set,
         },
         context_instance=RequestContext(request))
@@ -531,7 +531,10 @@ def json_tags_starting_with(request, callback=None):
         result = [prefix, tags_list]
     else:
         result = {"matches": tags_list}
         result = [prefix, tags_list]
     else:
         result = {"matches": tags_list}
-    return JsonResponse(result, callback)
+    response = JsonResponse(result, safe=False)
+    if callback:
+        response.content = callback + "(" + response.content + ");"
+    return response
 
 
 # =========
 
 
 # =========