display changes, mostly in book boxes
[wolnelektury.git] / apps / social / templatetags / social_tags.py
index deac93d..e78f20f 100755 (executable)
@@ -28,4 +28,14 @@ def cite_promo(ctx=None, fallback=False):
         'cite': cites.order_by('?')[0] if cites.exists() else None,
         'fallback': fallback,
         'ctx': ctx,
-    }
\ No newline at end of file
+    }
+
+
+@register.inclusion_tag('social/shelf_tags.html', takes_context=True)
+def shelf_tags(context, book):
+    user = context['request'].user
+    if not user.is_authenticated():
+        tags = []
+    else:
+        tags = book.tags.filter(category='set', user=user).exclude(name='')
+    return {'tags': tags}