Disable login_required.
[audio.git] / apps / archive / templatetags / tags.py
index 68a6a9b..8e208a6 100755 (executable)
@@ -2,18 +2,20 @@ from django import template
 
 register = template.Library()
 
-@register.simple_tag
-def multiple_tags_table(tags):
-    return template.loader.render_to_string(
-            "archive/tags/multiple_tags_table.html",
-            {"tags": tags}
-        )
+@register.inclusion_tag('archive/tags/multiple_tags_table.html')
+def multiple_tags_table(tags, table=True):
+    new_tags = {}
+    if tags:
+        for k, v in tags.items():
+            if isinstance(v, list):
+                new_tags[k] = v
+            else:
+                new_tags[k] = [v]
+    return {"tags": new_tags, "table": table}
 
 
-#@register.simple_tag
-#def multiple_tags_table(tags):
-#    return template.loader.render_to_string(
-#            "archive/tags/multiple_tags_table.html",
-#            {"tags": tags}
-#        )
-
+@register.inclusion_tag('archive/tags/tags_table.html')
+def tags_table(tags, table=True):
+    if tags is None:
+        tags = {}
+    return locals()