From: Jan Szejko <janek37@gmail.com>
Date: Thu, 21 Dec 2017 11:05:59 +0000 (+0100)
Subject: book/picture-only tags in api
X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/87b22d351ce199326613811ad544e24e0fa53d28

book/picture-only tags in api
---

diff --git a/src/api/handlers.py b/src/api/handlers.py
index 159e4f235..a1e9f6a23 100644
--- a/src/api/handlers.py
+++ b/src/api/handlers.py
@@ -523,6 +523,13 @@ class TagsHandler(BaseHandler, TagDetails):
 
         tags = Tag.objects.filter(category=category_sng).exclude(items=None).order_by('slug')
 
+        book_only = request.GET.get('book_only') == 'true'
+        picture_only = request.GET.get('picture_only') == 'true'
+        if book_only:
+            tags = tags.filter(for_books=True)
+        if picture_only:
+            tags = tags.filter(for_pictures=True)
+
         if after:
             tags = tags.filter(slug__gt=after)
         if before: