summaryrefslogtreecommitdiffstats
path: root/hyperkitty/views
diff options
context:
space:
mode:
Diffstat (limited to 'hyperkitty/views')
-rw-r--r--hyperkitty/views/thread.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/hyperkitty/views/thread.py b/hyperkitty/views/thread.py
index fa1b860..56f9f5c 100644
--- a/hyperkitty/views/thread.py
+++ b/hyperkitty/views/thread.py
@@ -245,6 +245,18 @@ def tags(request, mlist_fqdn, threadid):
return HttpResponse(json.dumps(response),
mimetype='application/javascript')
+def suggest_tags(request, mlist_fqdn, threadid):
+ term = request.GET.get("term")
+ current_tags = Tag.objects.filter(
+ list_address=mlist_fqdn, threadid=threadid
+ ).values_list("tag", flat=True)
+ if term:
+ tags = Tag.objects.filter(list_address=mlist_fqdn, tag__istartswith=term)
+ else:
+ tags = Tag.objects.all()
+ tags = tags.exclude(tag__in=current_tags).values_list("tag", flat=True)
+ tags = [ t.encode("utf8") for t in tags ]
+ return HttpResponse(json.dumps(tags), mimetype='application/javascript')
def favorite(request, mlist_fqdn, threadid):