Reorganize code.
[audio.git] / src / archive / templatetags / tags.py
diff --git a/src/archive/templatetags/tags.py b/src/archive/templatetags/tags.py
new file mode 100755 (executable)
index 0000000..8e208a6
--- /dev/null
@@ -0,0 +1,21 @@
+from django import template
+
+register = template.Library()
+
+@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.inclusion_tag('archive/tags/tags_table.html')
+def tags_table(tags, table=True):
+    if tags is None:
+        tags = {}
+    return locals()