]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/commands.py
fixes osqa-152: interesting and ignored tags work again. also fixed potential perfor...
[osqa.git] / forum / views / commands.py
index ee62af4c6859f2acb5ffd8171bbe29e8d2ded383..5a76d06c2bcf00159cdde1190fe885287dc52b1c 100644 (file)
@@ -346,6 +346,17 @@ def mark_tag(request, tag=None, **kwargs):#tagging system
             ts.update(reason=reason)
     return HttpResponse(simplejson.dumps(''), mimetype="application/json")
 
+def matching_tags(request):
+    if len(request.GET['q']) == 0:
+       raise Exception(_("Invalid request"))
+
+    possible_tags = Tag.objects.filter(name__istartswith = request.GET['q'])
+    tag_output = ''
+    for tag in possible_tags:
+        tag_output += (tag.name + "|" + tag.name + "." + tag.used_count.__str__() + "\n")
+        
+    return HttpResponse(tag_output, mimetype="text/plain")
+
 @ajax_login_required
 def ajax_toggle_ignored_questions(request):#ajax tagging and tag-filtering system
     if request.user.hide_ignored_questions: