book/picture-only tags in api
authorJan Szejko <janek37@gmail.com>
Thu, 21 Dec 2017 11:05:59 +0000 (12:05 +0100)
committerJan Szejko <janek37@gmail.com>
Thu, 21 Dec 2017 11:05:59 +0000 (12:05 +0100)
src/api/handlers.py

index 159e4f2..a1e9f6a 100644 (file)
@@ -523,6 +523,13 @@ class TagsHandler(BaseHandler, TagDetails):
 
         tags = Tag.objects.filter(category=category_sng).exclude(items=None).order_by('slug')
 
 
         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:
         if after:
             tags = tags.filter(slug__gt=after)
         if before: